aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-28 17:45:06 +0900
committernsfisis <nsfisis@gmail.com>2026-06-28 17:45:26 +0900
commit53f1fb395f33e0fb8db9aebd09ea9082f650f9f1 (patch)
treef9e8bf0e9d4b1e98cce383574fb6a13b684fff08 /crates
parent212f5cd75b1403ee75ffa44d7ebdb181174340c0 (diff)
downloadphp-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.tar.gz
php-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.tar.zst
php-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.zip
refactor: add linter
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe-external-packages/src/composer.rs (renamed from crates/shirabe-external-packages/src/composer/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/composer/ca_bundle.rs (renamed from crates/shirabe-external-packages/src/composer/ca_bundle/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/composer/pcre.rs (renamed from crates/shirabe-external-packages/src/composer/pcre/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/composer/pcre/preg.rs3
-rw-r--r--crates/shirabe-external-packages/src/composer/xdebug_handler.rs (renamed from crates/shirabe-external-packages/src/composer/xdebug_handler/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/psr.rs (renamed from crates/shirabe-external-packages/src/psr/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/psr/log.rs (renamed from crates/shirabe-external-packages/src/psr/log/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/seld.rs (renamed from crates/shirabe-external-packages/src/seld/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/seld/json_lint.rs (renamed from crates/shirabe-external-packages/src/seld/json_lint/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/seld/json_lint/json_parser.rs25
-rw-r--r--crates/shirabe-external-packages/src/seld/signal.rs (renamed from crates/shirabe-external-packages/src/seld/signal/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony.rs (renamed from crates/shirabe-external-packages/src/symfony/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console.rs (renamed from crates/shirabe-external-packages/src/symfony/console/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/attribute.rs (renamed from crates/shirabe-external-packages/src/symfony/console/attribute/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command.rs (renamed from crates/shirabe-external-packages/src/symfony/console/command/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs11
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command_loader.rs (renamed from crates/shirabe-external-packages/src/symfony/console/command_loader/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/completion.rs (renamed from crates/shirabe-external-packages/src/symfony/console/completion/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs3
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/completion/output.rs (renamed from crates/shirabe-external-packages/src/symfony/console/completion/output/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/descriptor.rs (renamed from crates/shirabe-external-packages/src/symfony/console/descriptor/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/exception.rs (renamed from crates/shirabe-external-packages/src/symfony/console/exception/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/formatter.rs (renamed from crates/shirabe-external-packages/src/symfony/console/formatter/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper.rs (renamed from crates/shirabe-external-packages/src/symfony/console/helper/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs2
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs4
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input.rs (renamed from crates/shirabe-external-packages/src/symfony/console/input/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs4
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/array_input.rs2
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs4
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/output.rs (renamed from crates/shirabe-external-packages/src/symfony/console/output/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/question.rs (renamed from crates/shirabe-external-packages/src/symfony/console/question/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/signal_registry.rs (renamed from crates/shirabe-external-packages/src/symfony/console/signal_registry/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style.rs (renamed from crates/shirabe-external-packages/src/symfony/console/style/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/filesystem.rs (renamed from crates/shirabe-external-packages/src/symfony/filesystem/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/filesystem/exception.rs (renamed from crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/finder.rs (renamed from crates/shirabe-external-packages/src/symfony/finder/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/finder/finder.rs11
-rw-r--r--crates/shirabe-external-packages/src/symfony/process.rs (renamed from crates/shirabe-external-packages/src/symfony/process/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/exception.rs (renamed from crates/shirabe-external-packages/src/symfony/process/exception/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/executable_finder.rs66
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs7
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes.rs (renamed from crates/shirabe-external-packages/src/symfony/process/pipes/mod.rs)0
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs15
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs16
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs5
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/process.rs235
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/process_utils.rs7
-rw-r--r--crates/shirabe-external-packages/src/symfony/string.rs (renamed from crates/shirabe-external-packages/src/symfony/string/mod.rs)0
-rw-r--r--crates/shirabe-semver/src/compiling_matcher.rs8
-rw-r--r--crates/shirabe-semver/src/constraint/bound.rs5
-rw-r--r--crates/shirabe-semver/src/constraint/simple_constraint.rs37
-rw-r--r--crates/shirabe-semver/src/intervals.rs20
-rw-r--r--crates/shirabe-semver/src/semver.rs3
-rw-r--r--crates/shirabe-semver/src/version_parser.rs78
-rw-r--r--crates/shirabe/src/advisory.rs (renamed from crates/shirabe/src/advisory/mod.rs)0
-rw-r--r--crates/shirabe/src/advisory/audit_config.rs5
-rw-r--r--crates/shirabe/src/advisory/auditor.rs17
-rw-r--r--crates/shirabe/src/advisory/security_advisory.rs5
-rw-r--r--crates/shirabe/src/autoload.rs (renamed from crates/shirabe/src/autoload/mod.rs)0
-rw-r--r--crates/shirabe/src/autoload/autoload_generator.rs28
-rw-r--r--crates/shirabe/src/autoload/class_loader.rs3
-rw-r--r--crates/shirabe/src/cache.rs14
-rw-r--r--crates/shirabe/src/command.rs (renamed from crates/shirabe/src/command/mod.rs)0
-rw-r--r--crates/shirabe/src/command/about_command.rs9
-rw-r--r--crates/shirabe/src/command/archive_command.rs19
-rw-r--r--crates/shirabe/src/command/audit_command.rs19
-rw-r--r--crates/shirabe/src/command/base_command.rs33
-rw-r--r--crates/shirabe/src/command/base_dependency_command.rs17
-rw-r--r--crates/shirabe/src/command/bump_command.rs23
-rw-r--r--crates/shirabe/src/command/check_platform_reqs_command.rs21
-rw-r--r--crates/shirabe/src/command/clear_cache_command.rs15
-rw-r--r--crates/shirabe/src/command/config_command.rs30
-rw-r--r--crates/shirabe/src/command/create_project_command.rs33
-rw-r--r--crates/shirabe/src/command/depends_command.rs13
-rw-r--r--crates/shirabe/src/command/diagnose_command.rs38
-rw-r--r--crates/shirabe/src/command/dump_autoload_command.rs15
-rw-r--r--crates/shirabe/src/command/exec_command.rs13
-rw-r--r--crates/shirabe/src/command/fund_command.rs17
-rw-r--r--crates/shirabe/src/command/global_command.rs18
-rw-r--r--crates/shirabe/src/command/home_command.rs17
-rw-r--r--crates/shirabe/src/command/init_command.rs33
-rw-r--r--crates/shirabe/src/command/install_command.rs15
-rw-r--r--crates/shirabe/src/command/licenses_command.rs23
-rw-r--r--crates/shirabe/src/command/outdated_command.rs11
-rw-r--r--crates/shirabe/src/command/package_discovery_trait.rs24
-rw-r--r--crates/shirabe/src/command/prohibits_command.rs11
-rw-r--r--crates/shirabe/src/command/reinstall_command.rs17
-rw-r--r--crates/shirabe/src/command/remove_command.rs21
-rw-r--r--crates/shirabe/src/command/repository_command.rs19
-rw-r--r--crates/shirabe/src/command/require_command.rs31
-rw-r--r--crates/shirabe/src/command/run_script_command.rs19
-rw-r--r--crates/shirabe/src/command/script_alias_command.rs13
-rw-r--r--crates/shirabe/src/command/search_command.rs19
-rw-r--r--crates/shirabe/src/command/self_update_command.rs15
-rw-r--r--crates/shirabe/src/command/show_command.rs38
-rw-r--r--crates/shirabe/src/command/status_command.rs15
-rw-r--r--crates/shirabe/src/command/update_command.rs37
-rw-r--r--crates/shirabe/src/command/validate_command.rs13
-rw-r--r--crates/shirabe/src/composer.rs3
-rw-r--r--crates/shirabe/src/config/json_config_source.rs11
-rw-r--r--crates/shirabe/src/console.rs (renamed from crates/shirabe/src/console/mod.rs)0
-rw-r--r--crates/shirabe/src/console/application.rs106
-rw-r--r--crates/shirabe/src/console/input.rs (renamed from crates/shirabe/src/console/input/mod.rs)0
-rw-r--r--crates/shirabe/src/dependency_resolver.rs (renamed from crates/shirabe/src/dependency_resolver/mod.rs)0
-rw-r--r--crates/shirabe/src/dependency_resolver/default_policy.rs10
-rw-r--r--crates/shirabe/src/dependency_resolver/generic_rule.rs3
-rw-r--r--crates/shirabe/src/dependency_resolver/lock_transaction.rs5
-rw-r--r--crates/shirabe/src/dependency_resolver/operation.rs (renamed from crates/shirabe/src/dependency_resolver/operation/mod.rs)0
-rw-r--r--crates/shirabe/src/dependency_resolver/pool.rs10
-rw-r--r--crates/shirabe/src/dependency_resolver/pool_builder.rs28
-rw-r--r--crates/shirabe/src/dependency_resolver/pool_optimizer.rs14
-rw-r--r--crates/shirabe/src/dependency_resolver/problem.rs20
-rw-r--r--crates/shirabe/src/dependency_resolver/request.rs7
-rw-r--r--crates/shirabe/src/dependency_resolver/rule.rs20
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set.rs10
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set_generator.rs10
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set_iterator.rs5
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_watch_graph.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_watch_node.rs5
-rw-r--r--crates/shirabe/src/dependency_resolver/solver.rs13
-rw-r--r--crates/shirabe/src/dependency_resolver/solver_problems_exception.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/transaction.rs13
-rw-r--r--crates/shirabe/src/downloader.rs (renamed from crates/shirabe/src/downloader/mod.rs)0
-rw-r--r--crates/shirabe/src/downloader/archive_downloader.rs15
-rw-r--r--crates/shirabe/src/downloader/change_report_interface.rs3
-rw-r--r--crates/shirabe/src/downloader/download_manager.rs13
-rw-r--r--crates/shirabe/src/downloader/dvcs_downloader_interface.rs3
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs24
-rw-r--r--crates/shirabe/src/downloader/git_downloader.rs17
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs17
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs9
-rw-r--r--crates/shirabe/src/downloader/vcs_downloader.rs15
-rw-r--r--crates/shirabe/src/event_dispatcher.rs (renamed from crates/shirabe/src/event_dispatcher/mod.rs)0
-rw-r--r--crates/shirabe/src/event_dispatcher/event_dispatcher.rs30
-rw-r--r--crates/shirabe/src/exception.rs (renamed from crates/shirabe/src/exception/mod.rs)0
-rw-r--r--crates/shirabe/src/factory.rs24
-rw-r--r--crates/shirabe/src/filter.rs (renamed from crates/shirabe/src/filter/mod.rs)0
-rw-r--r--crates/shirabe/src/filter/platform_requirement_filter.rs (renamed from crates/shirabe/src/filter/platform_requirement_filter/mod.rs)0
-rw-r--r--crates/shirabe/src/filter/platform_requirement_filter/ignore_list_platform_requirement_filter.rs7
-rw-r--r--crates/shirabe/src/installed_versions.rs6
-rw-r--r--crates/shirabe/src/installer/binary_installer.rs15
-rw-r--r--crates/shirabe/src/installer/installation_manager.rs17
-rw-r--r--crates/shirabe/src/installer/installer_event.rs5
-rw-r--r--crates/shirabe/src/installer/library_installer.rs13
-rw-r--r--crates/shirabe/src/io.rs (renamed from crates/shirabe/src/io/mod.rs)0
-rw-r--r--crates/shirabe/src/io/console_io.rs15
-rw-r--r--crates/shirabe/src/json.rs (renamed from crates/shirabe/src/json/mod.rs)0
-rw-r--r--crates/shirabe/src/json/json_file.rs13
-rw-r--r--crates/shirabe/src/json/json_manipulator.rs8
-rw-r--r--crates/shirabe/src/package.rs (renamed from crates/shirabe/src/package/mod.rs)0
-rw-r--r--crates/shirabe/src/package/alias_package.rs9
-rw-r--r--crates/shirabe/src/package/archiver.rs (renamed from crates/shirabe/src/package/archiver/mod.rs)0
-rw-r--r--crates/shirabe/src/package/archiver/archive_manager.rs13
-rw-r--r--crates/shirabe/src/package/archiver/phar_archiver.rs7
-rw-r--r--crates/shirabe/src/package/base_package.rs8
-rw-r--r--crates/shirabe/src/package/comparer.rs (renamed from crates/shirabe/src/package/comparer/mod.rs)0
-rw-r--r--crates/shirabe/src/package/comparer/comparer.rs3
-rw-r--r--crates/shirabe/src/package/complete_alias_package.rs5
-rw-r--r--crates/shirabe/src/package/complete_package_interface.rs3
-rw-r--r--crates/shirabe/src/package/dumper.rs (renamed from crates/shirabe/src/package/dumper/mod.rs)0
-rw-r--r--crates/shirabe/src/package/dumper/array_dumper.rs5
-rw-r--r--crates/shirabe/src/package/handle.rs5
-rw-r--r--crates/shirabe/src/package/loader.rs (renamed from crates/shirabe/src/package/loader/mod.rs)0
-rw-r--r--crates/shirabe/src/package/loader/array_loader.rs17
-rw-r--r--crates/shirabe/src/package/loader/root_package_loader.rs7
-rw-r--r--crates/shirabe/src/package/loader/validating_array_loader.rs12
-rw-r--r--crates/shirabe/src/package/locker.rs20
-rw-r--r--crates/shirabe/src/package/package.rs13
-rw-r--r--crates/shirabe/src/package/package_interface.rs7
-rw-r--r--crates/shirabe/src/package/root_alias_package.rs5
-rw-r--r--crates/shirabe/src/package/root_package.rs7
-rw-r--r--crates/shirabe/src/package/root_package_interface.rs8
-rw-r--r--crates/shirabe/src/package/version.rs (renamed from crates/shirabe/src/package/version/mod.rs)0
-rw-r--r--crates/shirabe/src/package/version/version_guesser.rs17
-rw-r--r--crates/shirabe/src/package/version/version_parser.rs6
-rw-r--r--crates/shirabe/src/package/version/version_selector.rs18
-rw-r--r--crates/shirabe/src/phpstan.rs (renamed from crates/shirabe/src/phpstan/mod.rs)0
-rw-r--r--crates/shirabe/src/platform.rs (renamed from crates/shirabe/src/platform/mod.rs)0
-rw-r--r--crates/shirabe/src/plugin.rs (renamed from crates/shirabe/src/plugin/mod.rs)0
-rw-r--r--crates/shirabe/src/plugin/capability.rs (renamed from crates/shirabe/src/plugin/capability/mod.rs)0
-rw-r--r--crates/shirabe/src/plugin/plugin_manager.rs16
-rw-r--r--crates/shirabe/src/plugin/post_file_download_event.rs5
-rw-r--r--crates/shirabe/src/plugin/pre_file_download_event.rs5
-rw-r--r--crates/shirabe/src/plugin/pre_pool_create_event.rs6
-rw-r--r--crates/shirabe/src/question.rs (renamed from crates/shirabe/src/question/mod.rs)0
-rw-r--r--crates/shirabe/src/repository.rs (renamed from crates/shirabe/src/repository/mod.rs)0
-rw-r--r--crates/shirabe/src/repository/array_repository.rs18
-rw-r--r--crates/shirabe/src/repository/artifact_repository.rs14
-rw-r--r--crates/shirabe/src/repository/composer_repository.rs26
-rw-r--r--crates/shirabe/src/repository/composite_repository.rs7
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs22
-rw-r--r--crates/shirabe/src/repository/handle.rs10
-rw-r--r--crates/shirabe/src/repository/installed_array_repository.rs5
-rw-r--r--crates/shirabe/src/repository/installed_filesystem_repository.rs7
-rw-r--r--crates/shirabe/src/repository/installed_repository.rs11
-rw-r--r--crates/shirabe/src/repository/path_repository.rs13
-rw-r--r--crates/shirabe/src/repository/platform_repository.rs25
-rw-r--r--crates/shirabe/src/repository/repository_factory.rs13
-rw-r--r--crates/shirabe/src/repository/repository_manager.rs7
-rw-r--r--crates/shirabe/src/repository/repository_set.rs15
-rw-r--r--crates/shirabe/src/repository/vcs.rs (renamed from crates/shirabe/src/repository/vcs/mod.rs)0
-rw-r--r--crates/shirabe/src/repository/vcs/forgejo_driver.rs15
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs11
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs21
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs19
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs21
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs21
-rw-r--r--crates/shirabe/src/repository/vcs/perforce_driver.rs7
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs15
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs9
-rw-r--r--crates/shirabe/src/repository/vcs_repository.rs13
-rw-r--r--crates/shirabe/src/script.rs (renamed from crates/shirabe/src/script/mod.rs)0
-rw-r--r--crates/shirabe/src/self_update.rs (renamed from crates/shirabe/src/self_update/mod.rs)0
-rw-r--r--crates/shirabe/src/util.rs (renamed from crates/shirabe/src/util/mod.rs)0
-rw-r--r--crates/shirabe/src/util/auth_helper.rs15
-rw-r--r--crates/shirabe/src/util/bitbucket.rs7
-rw-r--r--crates/shirabe/src/util/filesystem.rs8
-rw-r--r--crates/shirabe/src/util/git.rs22
-rw-r--r--crates/shirabe/src/util/github.rs9
-rw-r--r--crates/shirabe/src/util/gitlab.rs9
-rw-r--r--crates/shirabe/src/util/http.rs (renamed from crates/shirabe/src/util/http/mod.rs)0
-rw-r--r--crates/shirabe/src/util/http/curl_downloader.rs15
-rw-r--r--crates/shirabe/src/util/http/curl_response.rs3
-rw-r--r--crates/shirabe/src/util/http/proxy_manager.rs5
-rw-r--r--crates/shirabe/src/util/http/request_proxy.rs3
-rw-r--r--crates/shirabe/src/util/http_downloader.rs22
-rw-r--r--crates/shirabe/src/util/package_sorter.rs5
-rw-r--r--crates/shirabe/src/util/perforce.rs11
-rw-r--r--crates/shirabe/src/util/platform.rs8
-rw-r--r--crates/shirabe/src/util/process_executor.rs12
-rw-r--r--crates/shirabe/src/util/remote_filesystem.rs22
-rw-r--r--crates/shirabe/src/util/stream_context_factory.rs13
-rw-r--r--crates/shirabe/src/util/svn.rs14
-rw-r--r--crates/shirabe/tests/advisory/auditor_test.rs7
-rw-r--r--crates/shirabe/tests/application_test.rs5
-rw-r--r--crates/shirabe/tests/autoload/autoload_generator_test.rs11
-rw-r--r--crates/shirabe/tests/cache_test.rs7
-rw-r--r--crates/shirabe/tests/command/archive_command_test.rs8
-rw-r--r--crates/shirabe/tests/command/exec_command_test.rs2
-rw-r--r--crates/shirabe/tests/command/run_script_command_test.rs3
-rw-r--r--crates/shirabe/tests/common/config_stub.rs5
-rw-r--r--crates/shirabe/tests/common/http_downloader_mock.rs5
-rw-r--r--crates/shirabe/tests/common/io_mock.rs7
-rw-r--r--crates/shirabe/tests/common/process_executor_mock.rs5
-rw-r--r--crates/shirabe/tests/composer_test.rs5
-rw-r--r--crates/shirabe/tests/config_test.rs5
-rw-r--r--crates/shirabe/tests/dependency_resolver/default_policy_test.rs3
-rw-r--r--crates/shirabe/tests/dependency_resolver/pool_builder_test.rs7
-rw-r--r--crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs5
-rw-r--r--crates/shirabe/tests/dependency_resolver/pool_test.rs3
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs5
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_set_test.rs8
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_test.rs3
-rw-r--r--crates/shirabe/tests/dependency_resolver/solver_test.rs8
-rw-r--r--crates/shirabe/tests/dependency_resolver/transaction_test.rs3
-rw-r--r--crates/shirabe/tests/documentation_test.rs5
-rw-r--r--crates/shirabe/tests/downloader/archive_downloader_test.rs5
-rw-r--r--crates/shirabe/tests/downloader/download_manager_test.rs8
-rw-r--r--crates/shirabe/tests/downloader/file_downloader_test.rs12
-rw-r--r--crates/shirabe/tests/downloader/fossil_downloader_test.rs12
-rw-r--r--crates/shirabe/tests/downloader/git_downloader_test.rs14
-rw-r--r--crates/shirabe/tests/downloader/hg_downloader_test.rs10
-rw-r--r--crates/shirabe/tests/downloader/perforce_downloader_test.rs12
-rw-r--r--crates/shirabe/tests/downloader/xz_downloader_test.rs5
-rw-r--r--crates/shirabe/tests/downloader/zip_downloader_test.rs8
-rw-r--r--crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs10
-rw-r--r--crates/shirabe/tests/factory_test.rs5
-rw-r--r--crates/shirabe/tests/installer/binary_installer_test.rs13
-rw-r--r--crates/shirabe/tests/installer/installation_manager_test.rs8
-rw-r--r--crates/shirabe/tests/installer/installer_event_test.rs5
-rw-r--r--crates/shirabe/tests/installer/library_installer_test.rs13
-rw-r--r--crates/shirabe/tests/installer/metapackage_installer_test.rs8
-rw-r--r--crates/shirabe/tests/installer/suggested_packages_reporter_test.rs10
-rw-r--r--crates/shirabe/tests/package/archiver/archive_manager_test.rs5
-rw-r--r--crates/shirabe/tests/package/base_package_test.rs3
-rw-r--r--crates/shirabe/tests/package/loader/root_package_loader_test.rs8
-rw-r--r--crates/shirabe/tests/package/loader/validating_array_loader_test.rs3
-rw-r--r--crates/shirabe/tests/package/locker_test.rs5
-rw-r--r--crates/shirabe/tests/package/version/version_guesser_test.rs8
-rw-r--r--crates/shirabe/tests/package/version/version_selector_test.rs11
-rw-r--r--crates/shirabe/tests/question/strict_confirmation_question_test.rs5
-rw-r--r--crates/shirabe/tests/repository/array_repository_test.rs3
-rw-r--r--crates/shirabe/tests/repository/artifact_repository_test.rs5
-rw-r--r--crates/shirabe/tests/repository/composer_repository_test.rs8
-rw-r--r--crates/shirabe/tests/repository/composite_repository_test.rs3
-rw-r--r--crates/shirabe/tests/repository/filesystem_repository_test.rs8
-rw-r--r--crates/shirabe/tests/repository/filter_repository_test.rs3
-rw-r--r--crates/shirabe/tests/repository/installed_repository_test.rs3
-rw-r--r--crates/shirabe/tests/repository/path_repository_test.rs8
-rw-r--r--crates/shirabe/tests/repository/repository_factory_test.rs5
-rw-r--r--crates/shirabe/tests/repository/repository_manager_test.rs5
-rw-r--r--crates/shirabe/tests/repository/repository_utils_test.rs3
-rw-r--r--crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs10
-rw-r--r--crates/shirabe/tests/repository/vcs/fossil_driver_test.rs5
-rw-r--r--crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs10
-rw-r--r--crates/shirabe/tests/repository/vcs/git_driver_test.rs12
-rw-r--r--crates/shirabe/tests/repository/vcs/github_driver_test.rs16
-rw-r--r--crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs10
-rw-r--r--crates/shirabe/tests/repository/vcs/hg_driver_test.rs12
-rw-r--r--crates/shirabe/tests/repository/vcs/perforce_driver_test.rs8
-rw-r--r--crates/shirabe/tests/repository/vcs/svn_driver_test.rs12
-rw-r--r--crates/shirabe/tests/repository/vcs_repository_test.rs18
-rw-r--r--crates/shirabe/tests/script/event_test.rs5
-rw-r--r--crates/shirabe/tests/util/auth_helper_test.rs10
-rw-r--r--crates/shirabe/tests/util/bitbucket_test.rs14
-rw-r--r--crates/shirabe/tests/util/config_validator_test.rs5
-rw-r--r--crates/shirabe/tests/util/forgejo_test.rs12
-rw-r--r--crates/shirabe/tests/util/git_test.rs14
-rw-r--r--crates/shirabe/tests/util/github_test.rs12
-rw-r--r--crates/shirabe/tests/util/gitlab_test.rs12
-rw-r--r--crates/shirabe/tests/util/http_downloader_test.rs10
-rw-r--r--crates/shirabe/tests/util/perforce_test.rs10
-rw-r--r--crates/shirabe/tests/util/process_executor_test.rs5
-rw-r--r--crates/shirabe/tests/util/remote_filesystem_test.rs10
-rw-r--r--crates/shirabe/tests/util/svn_test.rs5
316 files changed, 1533 insertions, 1809 deletions
diff --git a/crates/shirabe-external-packages/src/composer/mod.rs b/crates/shirabe-external-packages/src/composer.rs
index 907f985..907f985 100644
--- a/crates/shirabe-external-packages/src/composer/mod.rs
+++ b/crates/shirabe-external-packages/src/composer.rs
diff --git a/crates/shirabe-external-packages/src/composer/ca_bundle/mod.rs b/crates/shirabe-external-packages/src/composer/ca_bundle.rs
index 2a32509..2a32509 100644
--- a/crates/shirabe-external-packages/src/composer/ca_bundle/mod.rs
+++ b/crates/shirabe-external-packages/src/composer/ca_bundle.rs
diff --git a/crates/shirabe-external-packages/src/composer/pcre/mod.rs b/crates/shirabe-external-packages/src/composer/pcre.rs
index 20c37d0..20c37d0 100644
--- a/crates/shirabe-external-packages/src/composer/pcre/mod.rs
+++ b/crates/shirabe-external-packages/src/composer/pcre.rs
diff --git a/crates/shirabe-external-packages/src/composer/pcre/preg.rs b/crates/shirabe-external-packages/src/composer/pcre/preg.rs
index 2c7430d..b4def4d 100644
--- a/crates/shirabe-external-packages/src/composer/pcre/preg.rs
+++ b/crates/shirabe-external-packages/src/composer/pcre/preg.rs
@@ -12,12 +12,11 @@
//! See docs/dev/regex-porting.md for more detailed regex porting rules.
use indexmap::IndexMap;
+pub use shirabe_php_shim::CaptureKey;
use shirabe_php_shim::{
PREG_OFFSET_CAPTURE, PREG_SET_ORDER, PREG_SPLIT_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL,
};
-pub use shirabe_php_shim::CaptureKey;
-
#[derive(Debug)]
pub struct Preg;
diff --git a/crates/shirabe-external-packages/src/composer/xdebug_handler/mod.rs b/crates/shirabe-external-packages/src/composer/xdebug_handler.rs
index c95f237..c95f237 100644
--- a/crates/shirabe-external-packages/src/composer/xdebug_handler/mod.rs
+++ b/crates/shirabe-external-packages/src/composer/xdebug_handler.rs
diff --git a/crates/shirabe-external-packages/src/psr/mod.rs b/crates/shirabe-external-packages/src/psr.rs
index 1e6bbb8..1e6bbb8 100644
--- a/crates/shirabe-external-packages/src/psr/mod.rs
+++ b/crates/shirabe-external-packages/src/psr.rs
diff --git a/crates/shirabe-external-packages/src/psr/log/mod.rs b/crates/shirabe-external-packages/src/psr/log.rs
index 17d71b7..17d71b7 100644
--- a/crates/shirabe-external-packages/src/psr/log/mod.rs
+++ b/crates/shirabe-external-packages/src/psr/log.rs
diff --git a/crates/shirabe-external-packages/src/seld/mod.rs b/crates/shirabe-external-packages/src/seld.rs
index b7c12c4..b7c12c4 100644
--- a/crates/shirabe-external-packages/src/seld/mod.rs
+++ b/crates/shirabe-external-packages/src/seld.rs
diff --git a/crates/shirabe-external-packages/src/seld/json_lint/mod.rs b/crates/shirabe-external-packages/src/seld/json_lint.rs
index 8027cb2..8027cb2 100644
--- a/crates/shirabe-external-packages/src/seld/json_lint/mod.rs
+++ b/crates/shirabe-external-packages/src/seld/json_lint.rs
diff --git a/crates/shirabe-external-packages/src/seld/json_lint/json_parser.rs b/crates/shirabe-external-packages/src/seld/json_lint/json_parser.rs
index 7cdf73b..317b4e5 100644
--- a/crates/shirabe-external-packages/src/seld/json_lint/json_parser.rs
+++ b/crates/shirabe-external-packages/src/seld/json_lint/json_parser.rs
@@ -1,13 +1,10 @@
//! ref: composer/vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php
-use std::collections::HashMap;
-
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use super::DuplicateKeyException;
use super::ParsingException;
use super::lexer::{Lexer, YylLoc};
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
/// Semantic value held on the parser value stack ($vstack). Most values are JSON values (PhpMixed),
/// but object members are represented as a `[key, value]` pair while being reduced.
@@ -42,10 +39,10 @@ enum ActionResult {
#[derive(Debug)]
pub struct JsonParser {
- productions_: HashMap<i64, (i64, i64)>,
- terminals_: HashMap<i64, &'static str>,
- table: Vec<HashMap<i64, TableAction>>,
- default_actions: HashMap<i64, (i64, i64)>,
+ productions_: IndexMap<i64, (i64, i64)>,
+ terminals_: IndexMap<i64, &'static str>,
+ table: Vec<IndexMap<i64, TableAction>>,
+ default_actions: IndexMap<i64, (i64, i64)>,
}
/// Per-parse mutable state. PHP keeps `$flags`/`$stack`/`$vstack`/`$lstack` on the parser instance;
@@ -81,7 +78,7 @@ impl JsonParser {
pub const ALLOW_DUPLICATE_KEYS_TO_ARRAY: u32 = 16;
pub fn new() -> Self {
- let productions_: HashMap<i64, (i64, i64)> = [
+ let productions_: IndexMap<i64, (i64, i64)> = [
(1, (3, 1)),
(2, (5, 1)),
(3, (7, 1)),
@@ -107,7 +104,7 @@ impl JsonParser {
.into_iter()
.collect();
- let terminals_: HashMap<i64, &'static str> = [
+ let terminals_: IndexMap<i64, &'static str> = [
(2, "error"),
(4, "STRING"),
(6, "NUMBER"),
@@ -127,7 +124,7 @@ impl JsonParser {
let table = build_table();
- let default_actions: HashMap<i64, (i64, i64)> = [(16, (2, 6))].into_iter().collect();
+ let default_actions: IndexMap<i64, (i64, i64)> = [(16, (2, 6))].into_iter().collect();
Self {
productions_,
@@ -790,9 +787,9 @@ fn trim_bytes(input: &[u8]) -> Vec<u8> {
}
/// Builds the LALR parse `table`. Indexed by state id (0..=31).
-fn build_table() -> Vec<HashMap<i64, TableAction>> {
+fn build_table() -> Vec<IndexMap<i64, TableAction>> {
use TableAction::{Action, Goto};
- let mut t: Vec<HashMap<i64, TableAction>> = (0..32).map(|_| HashMap::new()).collect();
+ let mut t: Vec<IndexMap<i64, TableAction>> = (0..32).map(|_| IndexMap::new()).collect();
let mut set = |state: usize, entries: &[(i64, TableAction)]| {
for (sym, act) in entries {
diff --git a/crates/shirabe-external-packages/src/seld/signal/mod.rs b/crates/shirabe-external-packages/src/seld/signal.rs
index 16f5151..16f5151 100644
--- a/crates/shirabe-external-packages/src/seld/signal/mod.rs
+++ b/crates/shirabe-external-packages/src/seld/signal.rs
diff --git a/crates/shirabe-external-packages/src/symfony/mod.rs b/crates/shirabe-external-packages/src/symfony.rs
index 9c572b2..9c572b2 100644
--- a/crates/shirabe-external-packages/src/symfony/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/mod.rs b/crates/shirabe-external-packages/src/symfony/console.rs
index 986c9ca..986c9ca 100644
--- a/crates/shirabe-external-packages/src/symfony/console/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/attribute/mod.rs b/crates/shirabe-external-packages/src/symfony/console/attribute.rs
index 241eb67..241eb67 100644
--- a/crates/shirabe-external-packages/src/symfony/console/attribute/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/attribute.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/mod.rs b/crates/shirabe-external-packages/src/symfony/console/command.rs
index b17d7f5..b17d7f5 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
index 3ed968e..7df1f80 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
@@ -1,11 +1,5 @@
//! ref: composer/vendor/symfony/console/Command/CompleteCommand.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
-
use crate::symfony::console::command::command::{Command, CommandData};
use crate::symfony::console::completion::completion_input::CompletionInput;
use crate::symfony::console::completion::completion_suggestions::{
@@ -15,6 +9,11 @@ use crate::symfony::console::completion::output::completion_output_interface::Co
use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::OutputInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::ops::{Deref, DerefMut};
+use std::rc::Rc;
/// Responsible for providing the values to the shell completion.
#[derive(Debug)]
diff --git a/crates/shirabe-external-packages/src/symfony/console/command_loader/mod.rs b/crates/shirabe-external-packages/src/symfony/console/command_loader.rs
index 97b3f54..97b3f54 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command_loader/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command_loader.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/mod.rs b/crates/shirabe-external-packages/src/symfony/console/completion.rs
index cb7f1d1..cb7f1d1 100644
--- a/crates/shirabe-external-packages/src/symfony/console/completion/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/completion.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs b/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs
index fe979cd..e0b8e09 100644
--- a/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs
@@ -1,10 +1,9 @@
//! ref: composer/vendor/symfony/console/Completion/CompletionInput.php
-use shirabe_php_shim::PhpMixed;
-
use crate::symfony::console::input::argv_input::ArgvInput;
use crate::symfony::console::input::input_definition::InputDefinition;
use crate::symfony::console::input::input_option::InputOption;
+use shirabe_php_shim::PhpMixed;
/// An input specialized for shell completion.
///
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/output/mod.rs b/crates/shirabe-external-packages/src/symfony/console/completion/output.rs
index 6bb0a2e..6bb0a2e 100644
--- a/crates/shirabe-external-packages/src/symfony/console/completion/output/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/completion/output.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/descriptor/mod.rs b/crates/shirabe-external-packages/src/symfony/console/descriptor.rs
index 9f85f92..9f85f92 100644
--- a/crates/shirabe-external-packages/src/symfony/console/descriptor/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/descriptor.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/console/exception.rs
index 356b595..356b595 100644
--- a/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/exception.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/formatter/mod.rs b/crates/shirabe-external-packages/src/symfony/console/formatter.rs
index 716d3fb..716d3fb 100644
--- a/crates/shirabe-external-packages/src/symfony/console/formatter/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/formatter.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs b/crates/shirabe-external-packages/src/symfony/console/helper.rs
index 8aed672..8aed672 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
index 030fda4..d3731b1 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
@@ -158,7 +158,7 @@ impl DebugFormatterHelper {
}
fn get_border(&self, id: &str) -> String {
- format!("<bg={}> </>", COLORS[self.started[id].border as usize],)
+ format!("<bg={}> </>", COLORS[self.started[id].border as usize])
}
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
index e1dbd1e..e26915e 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
@@ -16,7 +16,7 @@ pub struct FormatterHelper {
impl FormatterHelper {
/// Formats a message within a section.
pub fn format_section(&self, section: &str, message: &str, style: &str) -> String {
- format!("<{}>[{}]</{}> {}", style, section, style, message,)
+ format!("<{}>[{}]</{}> {}", style, section, style, message)
}
/// Formats a message as a block of text.
@@ -60,7 +60,7 @@ impl FormatterHelper {
let mut i = 0;
while i < messages.len() {
- messages[i] = format!("<{}>{}</{}>", style, messages[i].clone(), style,);
+ messages[i] = format!("<{}>{}</{}>", style, messages[i].clone(), style);
i += 1;
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/mod.rs b/crates/shirabe-external-packages/src/symfony/console/input.rs
index d4813b4..d4813b4 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs
index c1a708a..ad06da7 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs
@@ -317,7 +317,7 @@ impl ArgvInput {
let option_name = self.inner.definition.negation_to_name(name)?;
if !matches!(value, PhpMixed::Null) {
return Err(RuntimeException(shirabe_php_shim::RuntimeException {
- message: format!("The \"--{}\" option does not accept a value.", name,),
+ message: format!("The \"--{}\" option does not accept a value.", name),
code: 0,
})
.into());
@@ -333,7 +333,7 @@ impl ArgvInput {
if !matches!(value, PhpMixed::Null) && !option.accept_value() {
return Err(RuntimeException(shirabe_php_shim::RuntimeException {
- message: format!("The \"--{}\" option does not accept a value.", name,),
+ message: format!("The \"--{}\" option does not accept a value.", name),
code: 0,
})
.into());
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
index 051d8bd..eeea48c 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
@@ -259,7 +259,7 @@ impl ArrayInput {
if option.is_value_required() {
return Err(InvalidOptionException(InvalidArgumentException(
shirabe_php_shim::InvalidArgumentException {
- message: format!("The \"--{}\" option requires a value.", name,),
+ message: format!("The \"--{}\" option requires a value.", name),
code: 0,
},
))
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
index a1d3d30..279811f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
@@ -260,14 +260,14 @@ impl InputDefinition {
&& !option.equals(existing)
{
return Err(LogicException(shirabe_php_shim::LogicException {
- message: format!("An option named \"{}\" already exists.", option.get_name(),),
+ message: format!("An option named \"{}\" already exists.", option.get_name()),
code: 0,
})
.into());
}
if self.negations.contains_key(option.get_name()) {
return Err(LogicException(shirabe_php_shim::LogicException {
- message: format!("An option named \"{}\" already exists.", option.get_name(),),
+ message: format!("An option named \"{}\" already exists.", option.get_name()),
code: 0,
})
.into());
diff --git a/crates/shirabe-external-packages/src/symfony/console/output/mod.rs b/crates/shirabe-external-packages/src/symfony/console/output.rs
index 23a8e15..23a8e15 100644
--- a/crates/shirabe-external-packages/src/symfony/console/output/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/output.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/question/mod.rs b/crates/shirabe-external-packages/src/symfony/console/question.rs
index 06d03b4..06d03b4 100644
--- a/crates/shirabe-external-packages/src/symfony/console/question/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/question.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/signal_registry/mod.rs b/crates/shirabe-external-packages/src/symfony/console/signal_registry.rs
index a07ca01..a07ca01 100644
--- a/crates/shirabe-external-packages/src/symfony/console/signal_registry/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/signal_registry.rs
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/mod.rs b/crates/shirabe-external-packages/src/symfony/console/style.rs
index efc54e1..efc54e1 100644
--- a/crates/shirabe-external-packages/src/symfony/console/style/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/style.rs
diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/mod.rs b/crates/shirabe-external-packages/src/symfony/filesystem.rs
index 24be2ed..24be2ed 100644
--- a/crates/shirabe-external-packages/src/symfony/filesystem/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/filesystem.rs
diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/filesystem/exception.rs
index 2c19405..2c19405 100644
--- a/crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/filesystem/exception.rs
diff --git a/crates/shirabe-external-packages/src/symfony/finder/mod.rs b/crates/shirabe-external-packages/src/symfony/finder.rs
index 4b2d4b8..4b2d4b8 100644
--- a/crates/shirabe-external-packages/src/symfony/finder/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/finder.rs
diff --git a/crates/shirabe-external-packages/src/symfony/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
index 95ca5a4..2a7e544 100644
--- a/crates/shirabe-external-packages/src/symfony/finder/finder.rs
+++ b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
@@ -9,10 +9,9 @@
use crate::composer::pcre::{CaptureKey, Preg};
use crate::symfony::finder::glob::Glob;
use chrono::{NaiveDate, NaiveDateTime};
-use indexmap::IndexMap;
+use indexmap::{IndexMap, IndexSet};
use shirabe_php_shim::{file_exists, glob, is_dir, preg_quote, rtrim};
use std::cell::RefCell;
-use std::collections::HashSet;
use std::path::{Path, PathBuf};
use std::time::UNIX_EPOCH;
@@ -448,7 +447,7 @@ impl Finder {
relative_dir: &str,
depth: i64,
max_depth: i64,
- excluded_dirs: &HashSet<String>,
+ excluded_dirs: &IndexSet<String>,
excluded_pattern: &Option<String>,
out: &mut Vec<Entry>,
) {
@@ -553,8 +552,8 @@ impl Finder {
/// Reproduces `ExcludeDirectoryFilterIterator`'s constructor split between simple
/// directory names and `/`-containing path patterns.
-fn build_exclude(directories: &[String]) -> (HashSet<String>, Option<String>) {
- let mut excluded_dirs = HashSet::new();
+fn build_exclude(directories: &[String]) -> (IndexSet<String>, Option<String>) {
+ let mut excluded_dirs = IndexSet::new();
let mut patterns: Vec<String> = Vec::new();
for directory in directories {
@@ -579,7 +578,7 @@ fn build_exclude(directories: &[String]) -> (HashSet<String>, Option<String>) {
/// `ExcludeDirectoryFilterIterator::accept`.
fn exclude_accept(
entry: &Entry,
- excluded_dirs: &HashSet<String>,
+ excluded_dirs: &IndexSet<String>,
excluded_pattern: &Option<String>,
) -> bool {
if excluded_dirs.contains(&entry.filename) && entry.is_dir {
diff --git a/crates/shirabe-external-packages/src/symfony/process/mod.rs b/crates/shirabe-external-packages/src/symfony/process.rs
index 15967be..15967be 100644
--- a/crates/shirabe-external-packages/src/symfony/process/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/process.rs
diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/process/exception.rs
index 689a64b..689a64b 100644
--- a/crates/shirabe-external-packages/src/symfony/process/exception/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/exception.rs
diff --git a/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs b/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs
index a151283..3396b29 100644
--- a/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/executable_finder.rs
@@ -1,6 +1,6 @@
//! ref: composer/vendor/symfony/process/ExecutableFinder.php
-use shirabe_php_shim::{self as php, PhpMixed};
+use shirabe_php_shim::PhpMixed;
const CMD_BUILTINS: &[&str] = &[
"assoc", "break", "call", "cd", "chdir", "cls", "color", "copy", "date", "del", "dir", "echo",
@@ -37,25 +37,28 @@ impl ExecutableFinder {
pub fn find(&self, name: &str, default: Option<&str>, extra_dirs: &[String]) -> Option<String> {
// windows built-in commands that are present in cmd.exe should not be resolved using PATH as they do not exist as exes
- if php::DIRECTORY_SEPARATOR == "\\"
- && CMD_BUILTINS.contains(&php::strtolower(name).as_str())
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\"
+ && CMD_BUILTINS.contains(&shirabe_php_shim::strtolower(name).as_str())
{
return Some(name.to_string());
}
- let path = php::getenv("PATH")
- .or_else(|| php::getenv("Path"))
+ let path = shirabe_php_shim::getenv("PATH")
+ .or_else(|| shirabe_php_shim::getenv("Path"))
.map(|v| v.to_string_lossy().into_owned())
.unwrap_or_default();
- let mut dirs = php::explode(php::PATH_SEPARATOR, &path);
+ let mut dirs = shirabe_php_shim::explode(shirabe_php_shim::PATH_SEPARATOR, &path);
dirs.extend_from_slice(extra_dirs);
let mut suffixes: Vec<String> = vec![];
- if php::DIRECTORY_SEPARATOR == "\\" {
- let path_ext = php::getenv("PATHEXT").map(|v| v.to_string_lossy().into_owned());
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
+ let path_ext =
+ shirabe_php_shim::getenv("PATHEXT").map(|v| v.to_string_lossy().into_owned());
suffixes = self.suffixes.clone();
let exts = match path_ext {
- Some(ref ext) if !ext.is_empty() => php::explode(php::PATH_SEPARATOR, ext),
+ Some(ref ext) if !ext.is_empty() => {
+ shirabe_php_shim::explode(shirabe_php_shim::PATH_SEPARATOR, ext)
+ }
_ => vec![
".exe".to_string(),
".bat".to_string(),
@@ -65,10 +68,13 @@ impl ExecutableFinder {
};
suffixes.extend(exts);
}
- suffixes = if !php::pathinfo(PhpMixed::String(name.to_string()), php::PATHINFO_EXTENSION)
- .as_string()
- .unwrap_or("")
- .is_empty()
+ suffixes = if !shirabe_php_shim::pathinfo(
+ PhpMixed::String(name.to_string()),
+ shirabe_php_shim::PATHINFO_EXTENSION,
+ )
+ .as_string()
+ .unwrap_or("")
+ .is_empty()
{
let mut s = vec![String::new()];
s.extend(suffixes);
@@ -80,41 +86,49 @@ impl ExecutableFinder {
for suffix in &suffixes {
for dir in &dirs {
let dir = if dir.is_empty() { "." } else { dir.as_str() };
- let file = format!("{dir}{}{name}{suffix}", php::DIRECTORY_SEPARATOR);
- if php::is_file(&file)
- && (php::DIRECTORY_SEPARATOR == "\\" || php::is_executable(&file))
+ let file = format!(
+ "{dir}{}{name}{suffix}",
+ shirabe_php_shim::DIRECTORY_SEPARATOR
+ );
+ if shirabe_php_shim::is_file(&file)
+ && (shirabe_php_shim::DIRECTORY_SEPARATOR == "\\"
+ || shirabe_php_shim::is_executable(&file))
{
return Some(file);
}
- if !php::is_dir(dir)
- && php::basename(dir) == format!("{name}{suffix}")
- && php::is_executable(dir)
+ if !shirabe_php_shim::is_dir(dir)
+ && shirabe_php_shim::basename(dir) == format!("{name}{suffix}")
+ && shirabe_php_shim::is_executable(dir)
{
return Some(dir.to_string());
}
}
}
- if php::DIRECTORY_SEPARATOR == "\\"
- || name.len() != php::strcspn(name, &format!("/{}", php::DIRECTORY_SEPARATOR))
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\"
+ || name.len()
+ != shirabe_php_shim::strcspn(
+ name,
+ &format!("/{}", shirabe_php_shim::DIRECTORY_SEPARATOR),
+ )
{
return default.map(ToString::to_string);
}
- let exec_result = php::exec(
- &format!("command -v -- {}", php::escapeshellarg(name)),
+ let exec_result = shirabe_php_shim::exec(
+ &format!("command -v -- {}", shirabe_php_shim::escapeshellarg(name)),
None,
None,
)
.unwrap_or_default();
- let executable_path = php::substr(
+ let executable_path = shirabe_php_shim::substr(
&exec_result,
0,
- php::strpos(&exec_result, php::PHP_EOL).map(|i| i as i64),
+ shirabe_php_shim::strpos(&exec_result, shirabe_php_shim::PHP_EOL).map(|i| i as i64),
);
- if !executable_path.is_empty() && php::is_executable(&executable_path) {
+ if !executable_path.is_empty() && shirabe_php_shim::is_executable(&executable_path) {
return Some(executable_path);
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs b/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
index 9d04c5e..55ace18 100644
--- a/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs
@@ -1,7 +1,6 @@
//! ref: composer/vendor/symfony/process/PhpExecutableFinder.php
use super::executable_finder::ExecutableFinder;
-use shirabe_php_shim::{self as php};
#[derive(Debug)]
pub struct PhpExecutableFinder {
@@ -23,16 +22,16 @@ impl PhpExecutableFinder {
/// Finds The PHP executable.
pub fn find(&self, include_args: bool) -> Option<String> {
- if let Some(php) = php::getenv("PHP_BINARY").filter(|v| !v.is_empty()) {
+ if let Some(php) = shirabe_php_shim::getenv("PHP_BINARY").filter(|v| !v.is_empty()) {
let mut php = php.to_string_lossy().into_owned();
- if !php::is_executable(&php) {
+ if !shirabe_php_shim::is_executable(&php) {
match self.executable_finder.find(&php, None, &[]) {
Some(found) => php = found,
None => return None,
}
}
- if php::is_dir(&php) {
+ if shirabe_php_shim::is_dir(&php) {
return None;
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/mod.rs b/crates/shirabe-external-packages/src/symfony/process/pipes.rs
index 6a77f5f..6a77f5f 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes.rs
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
index 43a6567..f9fb251 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
@@ -1,7 +1,7 @@
//! ref: composer/vendor/symfony/process/Pipes/AbstractPipes.php
use indexmap::IndexMap;
-use shirabe_php_shim::{self as php, PhpMixed, PhpResource};
+use shirabe_php_shim::{PhpMixed, PhpResource};
#[derive(Debug)]
pub struct AbstractPipes {
@@ -38,7 +38,7 @@ impl AbstractPipes {
pub fn close(&mut self) {
for (_, pipe) in &self.pipes {
- php::fclose(pipe);
+ shirabe_php_shim::fclose(pipe);
}
self.pipes = IndexMap::new();
}
@@ -60,7 +60,7 @@ impl AbstractPipes {
}
for (_, pipe) in &self.pipes {
- php::stream_set_blocking(pipe, false);
+ shirabe_php_shim::stream_set_blocking(pipe, false);
}
// The `is_resource($this->input)` branch does not apply: `input` is never a resource in this
// port (is_resource on a PhpMixed is always false).
@@ -81,10 +81,11 @@ impl AbstractPipes {
let mut w: Vec<PhpResource> = vec![stdin.clone()];
// let's have a look if something changed in streams
- php::stream_select(&mut r, &mut w, &mut e, 0, Some(0))?;
+ shirabe_php_shim::stream_select(&mut r, &mut w, &mut e, 0, Some(0))?;
if !self.input_buffer.is_empty() {
- let written = php::fwrite(&stdin, &self.input_buffer, None).unwrap_or(0) as usize;
+ let written =
+ shirabe_php_shim::fwrite(&stdin, &self.input_buffer, None).unwrap_or(0) as usize;
self.input_buffer = self.input_buffer.get(written..).unwrap_or("").to_string();
if !self.input_buffer.is_empty() {
return Some(vec![stdin]);
@@ -92,9 +93,9 @@ impl AbstractPipes {
}
// no input to read on resource, buffer is empty
- if self.input_buffer.is_empty() && !php::php_truthy(&self.input) {
+ if self.input_buffer.is_empty() && !shirabe_php_shim::php_truthy(&self.input) {
self.input = PhpMixed::Null;
- php::fclose(&stdin);
+ shirabe_php_shim::fclose(&stdin);
self.pipes.shift_remove(&0);
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
index 795bb64..aff2a54 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
@@ -1,11 +1,10 @@
//! ref: composer/vendor/symfony/process/Pipes/UnixPipes.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{self as php, Descriptor, PhpMixed, PhpResource};
-
use crate::symfony::process::pipes::abstract_pipes::AbstractPipes;
use crate::symfony::process::pipes::pipes_interface::{CHUNK_SIZE, PipesInterface};
use crate::symfony::process::process::Process;
+use indexmap::IndexMap;
+use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};
/// UnixPipes implementation uses unix pipes as handles.
#[derive(Debug)]
@@ -44,7 +43,8 @@ fn descriptor(items: &[&str]) -> Descriptor {
impl PipesInterface for UnixPipes {
fn get_descriptors(&mut self) -> Vec<Descriptor> {
if !self.have_read_support {
- let nullstream = php::fopen("/dev/null", "c").expect("fopen('/dev/null') failed");
+ let nullstream =
+ shirabe_php_shim::fopen("/dev/null", "c").expect("fopen('/dev/null') failed");
return vec![
descriptor(&["pipe", "r"]),
Descriptor::Resource(nullstream.clone()),
@@ -100,7 +100,7 @@ impl PipesInterface for UnixPipes {
// let's have a look if something changed in streams
if (!r_sel.is_empty() || w.is_some())
- && php::stream_select(
+ && shirabe_php_shim::stream_select(
&mut r_sel,
&mut w_sel,
&mut e_sel,
@@ -125,7 +125,7 @@ impl PipesInterface for UnixPipes {
for (fd, pipe) in &r {
let mut data = String::new();
loop {
- let chunk = php::fread(pipe, CHUNK_SIZE).unwrap_or_default();
+ let chunk = shirabe_php_shim::fread(pipe, CHUNK_SIZE).unwrap_or_default();
let len = chunk.len() as i64;
data.push_str(&chunk);
if !(len > 0 && (close || len >= CHUNK_SIZE)) {
@@ -137,8 +137,8 @@ impl PipesInterface for UnixPipes {
read.insert(*fd, data);
}
- if close && php::feof(pipe) {
- php::fclose(pipe);
+ if close && shirabe_php_shim::feof(pipe) {
+ shirabe_php_shim::fclose(pipe);
self.inner.pipes.shift_remove(fd);
}
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
index a31f184..f721d2b 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
@@ -1,10 +1,9 @@
//! ref: composer/vendor/symfony/process/Pipes/WindowsPipes.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};
-
use crate::symfony::process::pipes::abstract_pipes::AbstractPipes;
use crate::symfony::process::pipes::pipes_interface::PipesInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};
/// WindowsPipes implementation uses temporary files as handles.
#[derive(Debug)]
diff --git a/crates/shirabe-external-packages/src/symfony/process/process.rs b/crates/shirabe-external-packages/src/symfony/process/process.rs
index fbf2da7..84bed62 100644
--- a/crates/shirabe-external-packages/src/symfony/process/process.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/process.rs
@@ -1,10 +1,5 @@
//! ref: composer/vendor/symfony/process/Process.php
-use std::sync::OnceLock;
-
-use indexmap::IndexMap;
-use shirabe_php_shim::{self as php, Descriptor, PhpMixed, PhpResource};
-
use crate::symfony::process::exception::invalid_argument_exception::InvalidArgumentException;
use crate::symfony::process::exception::logic_exception::LogicException;
use crate::symfony::process::exception::process_failed_exception::ProcessFailedException;
@@ -16,6 +11,9 @@ use crate::symfony::process::pipes::pipes_interface::PipesInterface;
use crate::symfony::process::pipes::unix_pipes::UnixPipes;
use crate::symfony::process::pipes::windows_pipes::WindowsPipes;
use crate::symfony::process::process_utils::ProcessUtils;
+use indexmap::IndexMap;
+use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};
+use std::sync::OnceLock;
/// A user-supplied callback invoked with the output type ("out"/"err") and a chunk of output.
pub type UserCallback = Box<dyn FnMut(&str, &str) -> bool>;
@@ -210,7 +208,7 @@ impl Process {
input: PhpMixed,
timeout: Option<f64>,
) -> anyhow::Result<Self> {
- if !php::function_exists("proc_open") {
+ if !shirabe_php_shim::function_exists("proc_open") {
return Err(LogicException::new(
"The Process class relies on proc_open, which is not available on your PHP installation.".to_string(),
)
@@ -227,7 +225,7 @@ impl Process {
// exists; its value merely reflects the NTS/ZTS build), so the disjunction is always true and
// the cwd is defaulted to getcwd() whenever it was null.
if this.cwd.is_none() {
- this.cwd = php::getcwd();
+ this.cwd = shirabe_php_shim::getcwd();
}
if let Some(env) = env {
this.set_env(
@@ -239,7 +237,7 @@ impl Process {
this.set_input(input)?;
this.set_timeout(timeout)?;
- this.use_file_handles = php::DIRECTORY_SEPARATOR == "\\";
+ this.use_file_handles = shirabe_php_shim::DIRECTORY_SEPARATOR == "\\";
this.pty = false;
Ok(this)
@@ -260,7 +258,7 @@ impl Process {
}
pub fn __sleep(&self) -> anyhow::Result<Vec<String>> {
- Err(php::BadMethodCallException {
+ Err(shirabe_php_shim::BadMethodCallException {
message: "Cannot serialize Symfony\\Component\\Process\\Process".to_string(),
code: 0,
}
@@ -268,7 +266,7 @@ impl Process {
}
pub fn __wakeup(&self) -> anyhow::Result<()> {
- Err(php::BadMethodCallException {
+ Err(shirabe_php_shim::BadMethodCallException {
message: "Cannot unserialize Symfony\\Component\\Process\\Process".to_string(),
code: 0,
}
@@ -310,7 +308,7 @@ impl Process {
}
self.reset_process_data();
- self.starttime = Some(php::microtime());
+ self.starttime = Some(shirabe_php_shim::microtime());
self.last_output_time = self.starttime;
let has_callback = callback.is_some();
self.callback = Some(self.build_callback(callback));
@@ -336,7 +334,7 @@ impl Process {
.collect::<Vec<_>>()
.join(" ");
- if php::DIRECTORY_SEPARATOR != "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR != "\\" {
// exec is mandatory to deal with sending a signal to the process
cmd = format!("exec {}", cmd);
}
@@ -345,7 +343,7 @@ impl Process {
CommandLine::String(s) => self.replace_placeholders(s, &env)?,
};
- if php::DIRECTORY_SEPARATOR == "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
commandline = self.prepare_windows_command_line(&commandline, &mut env)?;
} else if !self.use_file_handles && self.is_sigchild_enabled() {
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
@@ -357,7 +355,7 @@ impl Process {
);
// Workaround for the bug, when PTS functionality is enabled.
- let _pts_workaround = php::fopen("Process.php", "r");
+ let _pts_workaround = shirabe_php_shim::fopen("Process.php", "r");
}
let mut env_pairs: Vec<String> = Vec::new();
@@ -368,7 +366,12 @@ impl Process {
}
}
- if !self.cwd.as_deref().map(php::is_dir).unwrap_or(false) {
+ if !self
+ .cwd
+ .as_deref()
+ .map(shirabe_php_shim::is_dir)
+ .unwrap_or(false)
+ {
return Err(RuntimeException::new(format!(
"The provided cwd \"{}\" does not exist.",
self.cwd.as_deref().unwrap_or("")
@@ -380,7 +383,7 @@ impl Process {
let options = self.options.clone();
let process = {
let pipes = self.process_pipes.as_mut().unwrap().pipes_mut();
- php::proc_open(
+ shirabe_php_shim::proc_open(
&commandline,
&descriptors,
pipes,
@@ -407,7 +410,7 @@ impl Process {
.get(&3)
.cloned();
let pid = pipe3
- .and_then(|p| php::fgets(&p, None))
+ .and_then(|p| shirabe_php_shim::fgets(&p, None))
.map(|s| s.trim().parse::<i64>().unwrap_or(0))
.unwrap_or(0);
self.fallback_status
@@ -459,9 +462,12 @@ impl Process {
loop {
self.check_timeout()?;
let running = self.is_running()
- && (php::DIRECTORY_SEPARATOR == "\\"
+ && (shirabe_php_shim::DIRECTORY_SEPARATOR == "\\"
|| self.process_pipes.as_ref().unwrap().are_open());
- self.read_pipes(running, php::DIRECTORY_SEPARATOR != "\\" || !running);
+ self.read_pipes(
+ running,
+ shirabe_php_shim::DIRECTORY_SEPARATOR != "\\" || !running,
+ );
if !running {
break;
}
@@ -469,14 +475,14 @@ impl Process {
while self.is_running() {
self.check_timeout()?;
- php::usleep(1000);
+ shirabe_php_shim::usleep(1000);
}
let signaled = self
.process_information
.as_ref()
.and_then(|i| i.get("signaled"))
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false);
let termsig = self
.process_information
@@ -507,16 +513,15 @@ impl Process {
let mut ready = false;
loop {
self.check_timeout()?;
- let running = if php::DIRECTORY_SEPARATOR == "\\" {
+ let running = if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
self.is_running()
} else {
self.process_pipes.as_ref().unwrap().are_open()
};
- let output = self
- .process_pipes
- .as_mut()
- .unwrap()
- .read_and_write(running, php::DIRECTORY_SEPARATOR != "\\" || !running);
+ let output = self.process_pipes.as_mut().unwrap().read_and_write(
+ running,
+ shirabe_php_shim::DIRECTORY_SEPARATOR != "\\" || !running,
+ );
for (r#type, data) in output {
if r#type != 3 {
@@ -544,7 +549,7 @@ impl Process {
return Ok(false);
}
- php::usleep(1000);
+ shirabe_php_shim::usleep(1000);
}
}
@@ -609,19 +614,23 @@ impl Process {
pub fn get_output(&mut self) -> anyhow::Result<String> {
self.read_pipes_for_output("getOutput", false)?;
- Ok(php::stream_get_contents3(self.stdout.as_ref().unwrap(), -1, 0).unwrap_or_default())
+ Ok(
+ shirabe_php_shim::stream_get_contents3(self.stdout.as_ref().unwrap(), -1, 0)
+ .unwrap_or_default(),
+ )
}
/// Returns the output incrementally.
pub fn get_incremental_output(&mut self) -> anyhow::Result<String> {
self.read_pipes_for_output("getIncrementalOutput", false)?;
- let latest = php::stream_get_contents3(
+ let latest = shirabe_php_shim::stream_get_contents3(
self.stdout.as_ref().unwrap(),
-1,
self.incremental_output_offset,
);
- self.incremental_output_offset = php::ftell(self.stdout.as_ref().unwrap()).unwrap_or(0);
+ self.incremental_output_offset =
+ shirabe_php_shim::ftell(self.stdout.as_ref().unwrap()).unwrap_or(0);
Ok(latest.unwrap_or_default())
}
@@ -639,14 +648,14 @@ impl Process {
let mut yields = Vec::new();
while self.callback.is_some()
- || (yield_out && !php::feof(self.stdout.as_ref().unwrap()))
- || (yield_err && !php::feof(self.stderr.as_ref().unwrap()))
+ || (yield_out && !shirabe_php_shim::feof(self.stdout.as_ref().unwrap()))
+ || (yield_err && !shirabe_php_shim::feof(self.stderr.as_ref().unwrap()))
{
let mut got_out = false;
let mut got_err = false;
if yield_out {
- let out = php::stream_get_contents3(
+ let out = shirabe_php_shim::stream_get_contents3(
self.stdout.as_ref().unwrap(),
-1,
self.incremental_output_offset,
@@ -659,7 +668,7 @@ impl Process {
self.clear_output();
} else {
self.incremental_output_offset =
- php::ftell(self.stdout.as_ref().unwrap()).unwrap_or(0);
+ shirabe_php_shim::ftell(self.stdout.as_ref().unwrap()).unwrap_or(0);
}
yields.push((Self::OUT.to_string(), out));
@@ -667,7 +676,7 @@ impl Process {
}
if yield_err {
- let err = php::stream_get_contents3(
+ let err = shirabe_php_shim::stream_get_contents3(
self.stderr.as_ref().unwrap(),
-1,
self.incremental_error_output_offset,
@@ -680,7 +689,7 @@ impl Process {
self.clear_error_output();
} else {
self.incremental_error_output_offset =
- php::ftell(self.stderr.as_ref().unwrap()).unwrap_or(0);
+ shirabe_php_shim::ftell(self.stderr.as_ref().unwrap()).unwrap_or(0);
}
yields.push((Self::ERR.to_string(), err));
@@ -700,8 +709,8 @@ impl Process {
/// Clears the process output.
pub fn clear_output(&mut self) -> &mut Self {
- php::ftruncate(self.stdout.as_ref().unwrap(), 0);
- php::fseek(self.stdout.as_ref().unwrap(), 0, php::SEEK_SET);
+ shirabe_php_shim::ftruncate(self.stdout.as_ref().unwrap(), 0);
+ shirabe_php_shim::fseek(self.stdout.as_ref().unwrap(), 0, shirabe_php_shim::SEEK_SET);
self.incremental_output_offset = 0;
self
@@ -711,28 +720,31 @@ impl Process {
pub fn get_error_output(&mut self) -> anyhow::Result<String> {
self.read_pipes_for_output("getErrorOutput", false)?;
- Ok(php::stream_get_contents3(self.stderr.as_ref().unwrap(), -1, 0).unwrap_or_default())
+ Ok(
+ shirabe_php_shim::stream_get_contents3(self.stderr.as_ref().unwrap(), -1, 0)
+ .unwrap_or_default(),
+ )
}
/// Returns the errorOutput incrementally.
pub fn get_incremental_error_output(&mut self) -> anyhow::Result<String> {
self.read_pipes_for_output("getIncrementalErrorOutput", false)?;
- let latest = php::stream_get_contents3(
+ let latest = shirabe_php_shim::stream_get_contents3(
self.stderr.as_ref().unwrap(),
-1,
self.incremental_error_output_offset,
);
self.incremental_error_output_offset =
- php::ftell(self.stderr.as_ref().unwrap()).unwrap_or(0);
+ shirabe_php_shim::ftell(self.stderr.as_ref().unwrap()).unwrap_or(0);
Ok(latest.unwrap_or_default())
}
/// Clears the process error output.
pub fn clear_error_output(&mut self) -> &mut Self {
- php::ftruncate(self.stderr.as_ref().unwrap(), 0);
- php::fseek(self.stderr.as_ref().unwrap(), 0, php::SEEK_SET);
+ shirabe_php_shim::ftruncate(self.stderr.as_ref().unwrap(), 0);
+ shirabe_php_shim::fseek(self.stderr.as_ref().unwrap(), 0, shirabe_php_shim::SEEK_SET);
self.incremental_error_output_offset = 0;
self
@@ -769,7 +781,7 @@ impl Process {
.process_information
.as_ref()
.and_then(|i| i.get("signaled"))
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false))
}
@@ -800,7 +812,7 @@ impl Process {
.process_information
.as_ref()
.and_then(|i| i.get("stopped"))
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false))
}
@@ -827,7 +839,7 @@ impl Process {
self.process_information
.as_ref()
.and_then(|i| i.get("running"))
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false)
}
@@ -852,14 +864,14 @@ impl Process {
/// Stops the process.
pub fn stop(&mut self, timeout: f64, signal: Option<i64>) -> Option<i64> {
- let timeout_micro = php::microtime() + timeout;
+ let timeout_micro = shirabe_php_shim::microtime() + timeout;
if self.is_running() {
// given SIGTERM may not be defined and that "proc_terminate" uses the constant value
// and not the constant itself, we use the same here
let _ = self.do_signal(15, false);
loop {
- php::usleep(1000);
- if !(self.is_running() && php::microtime() < timeout_micro) {
+ shirabe_php_shim::usleep(1000);
+ if !(self.is_running() && shirabe_php_shim::microtime() < timeout_micro) {
break;
}
}
@@ -885,22 +897,30 @@ impl Process {
/// Adds a line to the STDOUT stream.
pub fn add_output(&mut self, line: &str) {
- self.last_output_time = Some(php::microtime());
+ self.last_output_time = Some(shirabe_php_shim::microtime());
let stdout = self.stdout.as_ref().unwrap();
- php::fseek(stdout, 0, php::SEEK_END);
- php::fwrite(stdout, line, Some(line.len() as i64));
- php::fseek(stdout, self.incremental_output_offset, php::SEEK_SET);
+ shirabe_php_shim::fseek(stdout, 0, shirabe_php_shim::SEEK_END);
+ shirabe_php_shim::fwrite(stdout, line, Some(line.len() as i64));
+ shirabe_php_shim::fseek(
+ stdout,
+ self.incremental_output_offset,
+ shirabe_php_shim::SEEK_SET,
+ );
}
/// Adds a line to the STDERR stream.
pub fn add_error_output(&mut self, line: &str) {
- self.last_output_time = Some(php::microtime());
+ self.last_output_time = Some(shirabe_php_shim::microtime());
let stderr = self.stderr.as_ref().unwrap();
- php::fseek(stderr, 0, php::SEEK_END);
- php::fwrite(stderr, line, Some(line.len() as i64));
- php::fseek(stderr, self.incremental_error_output_offset, php::SEEK_SET);
+ shirabe_php_shim::fseek(stderr, 0, shirabe_php_shim::SEEK_END);
+ shirabe_php_shim::fwrite(stderr, line, Some(line.len() as i64));
+ shirabe_php_shim::fseek(
+ stderr,
+ self.incremental_error_output_offset,
+ shirabe_php_shim::SEEK_SET,
+ );
}
/// Gets the last output time in seconds.
@@ -953,7 +973,7 @@ impl Process {
/// Enables or disables the TTY mode.
pub fn set_tty(&mut self, tty: bool) -> anyhow::Result<&mut Self> {
- if php::DIRECTORY_SEPARATOR == "\\" && tty {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" && tty {
return Err(RuntimeException::new(
"TTY mode is not supported on Windows platform.".to_string(),
)
@@ -994,7 +1014,7 @@ impl Process {
if self.cwd.is_none() {
// getcwd() will return false if any one of the parent directories does not have
// the readable or search mode set, even if the current directory does
- return php::getcwd().filter(|s| !s.is_empty());
+ return shirabe_php_shim::getcwd().filter(|s| !s.is_empty());
}
self.cwd.clone()
@@ -1046,7 +1066,7 @@ impl Process {
}
if let Some(timeout) = self.timeout
- && timeout < php::microtime() - self.starttime.unwrap_or(0.0)
+ && timeout < shirabe_php_shim::microtime() - self.starttime.unwrap_or(0.0)
{
self.stop(0.0, None);
@@ -1058,7 +1078,7 @@ impl Process {
}
if let Some(idle_timeout) = self.idle_timeout
- && idle_timeout < php::microtime() - self.last_output_time.unwrap_or(0.0)
+ && idle_timeout < shirabe_php_shim::microtime() - self.last_output_time.unwrap_or(0.0)
{
self.stop(0.0, None);
@@ -1119,7 +1139,7 @@ impl Process {
*IS_TTY_SUPPORTED.get_or_init(|| {
let mut pipes = IndexMap::new();
- php::proc_open(
+ shirabe_php_shim::proc_open(
"echo 1 >/dev/null",
&[
descriptor(&["file", "/dev/tty", "r"]),
@@ -1140,12 +1160,12 @@ impl Process {
static RESULT: OnceLock<bool> = OnceLock::new();
*RESULT.get_or_init(|| {
- if php::DIRECTORY_SEPARATOR == "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
return false;
}
let mut pipes = IndexMap::new();
- php::proc_open(
+ shirabe_php_shim::proc_open(
"echo 1 >/dev/null",
&[
descriptor(&["pty"]),
@@ -1164,7 +1184,7 @@ impl Process {
/// Creates the descriptors needed by the proc_open.
fn get_descriptors(&mut self) -> Vec<Descriptor> {
// TODO(plugin): $this->input instanceof \Iterator -> rewind() is not modeled.
- if php::DIRECTORY_SEPARATOR == "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
self.process_pipes = Some(Box::new(WindowsPipes::new(
self.input.clone(),
!self.output_disabled || self.has_callback,
@@ -1219,17 +1239,19 @@ impl Process {
return;
}
- self.process_information = Some(php::proc_get_status(self.process.as_ref().unwrap()));
+ self.process_information = Some(shirabe_php_shim::proc_get_status(
+ self.process.as_ref().unwrap(),
+ ));
let running = self
.process_information
.as_ref()
.unwrap()
.get("running")
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false);
// In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call.
- if php::PHP_VERSION_ID < 80300 {
+ if shirabe_php_shim::PHP_VERSION_ID < 80300 {
let exitcode = self
.process_information
.as_ref()
@@ -1253,7 +1275,7 @@ impl Process {
self.read_pipes(
running && blocking,
- php::DIRECTORY_SEPARATOR != "\\" || !running,
+ shirabe_php_shim::DIRECTORY_SEPARATOR != "\\" || !running,
);
if !self.fallback_status.is_empty() && self.is_sigchild_enabled() {
@@ -1278,16 +1300,16 @@ impl Process {
return *v;
}
- if !php::function_exists("phpinfo") {
+ if !shirabe_php_shim::function_exists("phpinfo") {
return *SIGCHILD.get_or_init(|| false);
}
- php::ob_start();
- php::phpinfo(php::INFO_GENERAL);
+ shirabe_php_shim::ob_start();
+ shirabe_php_shim::phpinfo(shirabe_php_shim::INFO_GENERAL);
*SIGCHILD.get_or_init(|| {
- php::str_contains(
- &php::ob_get_clean().unwrap_or_default(),
+ shirabe_php_shim::str_contains(
+ &shirabe_php_shim::ob_get_clean().unwrap_or_default(),
"--enable-sigchild",
)
})
@@ -1359,7 +1381,7 @@ impl Process {
p.close();
}
if self.process.is_some() {
- php::proc_close(self.process.as_ref().unwrap());
+ shirabe_php_shim::proc_close(self.process.as_ref().unwrap());
self.process = None;
}
self.exitcode = self
@@ -1374,7 +1396,7 @@ impl Process {
.process_information
.as_ref()
.and_then(|i| i.get("signaled"))
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false);
let termsig = self
.process_information
@@ -1407,10 +1429,14 @@ impl Process {
self.fallback_status = IndexMap::new();
self.process_information = None;
// php://temp is an in-memory stream; fopen never fails for it.
- self.stdout =
- Some(php::fopen(&format!("php://temp/maxmemory:{}", 1024 * 1024), "w+").unwrap());
- self.stderr =
- Some(php::fopen(&format!("php://temp/maxmemory:{}", 1024 * 1024), "w+").unwrap());
+ self.stdout = Some(
+ shirabe_php_shim::fopen(&format!("php://temp/maxmemory:{}", 1024 * 1024), "w+")
+ .unwrap(),
+ );
+ self.stderr = Some(
+ shirabe_php_shim::fopen(&format!("php://temp/maxmemory:{}", 1024 * 1024), "w+")
+ .unwrap(),
+ );
self.process = None;
self.latest_signal = None;
self.status = Self::STATUS_READY.to_string();
@@ -1434,10 +1460,10 @@ impl Process {
Some(pid) => pid,
};
- if php::DIRECTORY_SEPARATOR == "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR == "\\" {
let mut output: Vec<String> = Vec::new();
let mut exit_code: i64 = 0;
- php::exec(
+ shirabe_php_shim::exec(
&format!("taskkill /F /T /PID {} 2>&1", pid),
Some(&mut output),
Some(&mut exit_code),
@@ -1456,12 +1482,12 @@ impl Process {
} else {
let ok;
if !self.is_sigchild_enabled() {
- ok = php::proc_terminate(self.process.as_ref().unwrap(), signal);
- } else if php::function_exists("posix_kill") {
- ok = php::posix_kill(pid, signal);
+ ok = shirabe_php_shim::proc_terminate(self.process.as_ref().unwrap(), signal);
+ } else if shirabe_php_shim::function_exists("posix_kill") {
+ ok = shirabe_php_shim::posix_kill(pid, signal);
} else {
let mut pipes = IndexMap::new();
- let opened = php::proc_open(
+ let opened = shirabe_php_shim::proc_open(
&format!("kill -{} {}", signal, pid),
&[
Descriptor::Inherit,
@@ -1474,7 +1500,10 @@ impl Process {
None,
);
ok = match opened {
- Ok(_) => pipes.get(&2).and_then(|p| php::fgets(p, None)).is_none(),
+ Ok(_) => pipes
+ .get(&2)
+ .and_then(|p| shirabe_php_shim::fgets(p, None))
+ .is_none(),
Err(_) => false,
};
}
@@ -1509,10 +1538,10 @@ impl Process {
cmd: &str,
env: &mut IndexMap<String, PhpMixed>,
) -> anyhow::Result<String> {
- let uid = php::uniqid("", true);
+ let uid = shirabe_php_shim::uniqid("", true);
let mut var_count = 0;
let mut var_cache: IndexMap<String, String> = IndexMap::new();
- let cmd = php::preg_replace_callback(
+ let cmd = shirabe_php_shim::preg_replace_callback(
r#"/"(?:(
[^"%!^]*+
(?:
@@ -1533,7 +1562,7 @@ impl Process {
if value.contains('\0') {
value = value.replace('\0', "?");
}
- if php::strpbrk(&value, "\"%!\n").is_none() {
+ if shirabe_php_shim::strpbrk(&value, "\"%!\n").is_none() {
return Ok(format!("\"{}\"", value));
}
@@ -1548,7 +1577,7 @@ impl Process {
}
value = format!(
"\"{}\"",
- php::preg_replace(r#"/(\\*)"/"#, "$1$1\\\"", &value)
+ shirabe_php_shim::preg_replace(r#"/(\\*)"/"#, "$1$1\\\"", &value)
);
var_count += 1;
let var = format!("{}{}", uid, var_count);
@@ -1570,7 +1599,7 @@ impl Process {
.map(|spec| {
format!(
"\"{}\"",
- php::preg_replace(r#"{(\\*+)"}"#, "$1$1\\\"", &spec)
+ shirabe_php_shim::preg_replace(r#"{(\\*+)"}"#, "$1$1\\\"", &spec)
)
})
})
@@ -1618,17 +1647,21 @@ impl Process {
None | Some("") => return "\"\"".to_string(),
Some(a) => a,
};
- if php::DIRECTORY_SEPARATOR != "\\" {
+ if shirabe_php_shim::DIRECTORY_SEPARATOR != "\\" {
return format!("'{}'", argument.replace('\'', "'\\''"));
}
let mut argument = argument.to_string();
if argument.contains('\0') {
argument = argument.replace('\0', "?");
}
- if !php::preg_match(r#"/[()%!^"<>&|\s\[\]=;*?'$]/"#, &argument, &mut Vec::new()) {
+ if !shirabe_php_shim::preg_match(
+ r#"/[()%!^"<>&|\s\[\]=;*?'$]/"#,
+ &argument,
+ &mut Vec::new(),
+ ) {
return argument;
}
- argument = php::preg_replace(r"/(\\+)$/", "$1$1", &argument);
+ argument = shirabe_php_shim::preg_replace(r"/(\\+)$/", "$1$1", &argument);
let mut result = argument;
for (from, to) in [
@@ -1648,7 +1681,7 @@ impl Process {
commandline: &str,
env: &IndexMap<String, PhpMixed>,
) -> anyhow::Result<String> {
- php::preg_replace_callback(
+ shirabe_php_shim::preg_replace_callback(
r#"/"\$\{:([_a-zA-Z]+[_a-zA-Z0-9]*)\}"/"#,
|matches: &[Option<String>]| -> anyhow::Result<String> {
let key = matches.get(1).cloned().flatten().unwrap_or_default();
@@ -1671,7 +1704,7 @@ impl Process {
}
fn get_default_env(&self) -> IndexMap<String, PhpMixed> {
- let env: IndexMap<String, String> = php::getenv_all()
+ let env: IndexMap<String, String> = shirabe_php_shim::getenv_all()
.map(|(k, v)| {
(
k.to_string_lossy().into_owned(),
@@ -1679,7 +1712,7 @@ impl Process {
)
})
.collect();
- let server = php::PHP_SERVER.lock().unwrap();
+ let server = shirabe_php_shim::PHP_SERVER.lock().unwrap();
// non-Windows: array_intersect_key($env, $_SERVER) ?: $env
let mut intersect: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -1697,7 +1730,7 @@ impl Process {
};
// $_ENV + env_map
- let mut result: IndexMap<String, PhpMixed> = php::PHP_ENV
+ let mut result: IndexMap<String, PhpMixed> = shirabe_php_shim::PHP_ENV
.lock()
.unwrap()
.get_all()
@@ -1739,7 +1772,7 @@ impl Drop for Process {
if self
.options
.get("create_new_console")
- .map(php::php_truthy)
+ .map(shirabe_php_shim::php_truthy)
.unwrap_or(false)
{
if let Some(p) = self.process_pipes.as_mut() {
diff --git a/crates/shirabe-external-packages/src/symfony/process/process_utils.rs b/crates/shirabe-external-packages/src/symfony/process/process_utils.rs
index 7287b28..71943b8 100644
--- a/crates/shirabe-external-packages/src/symfony/process/process_utils.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/process_utils.rs
@@ -1,8 +1,7 @@
//! ref: composer/vendor/symfony/process/ProcessUtils.php
-use shirabe_php_shim::{self as php, PhpMixed};
-
use crate::symfony::process::exception::invalid_argument_exception::InvalidArgumentException;
+use shirabe_php_shim::PhpMixed;
/// ProcessUtils is a bunch of utility methods.
#[derive(Debug)]
@@ -12,10 +11,10 @@ impl ProcessUtils {
/// Validates and normalizes a Process input.
pub fn validate_input(caller: &str, input: PhpMixed) -> anyhow::Result<PhpMixed> {
if !input.is_null() {
- if php::is_string(&input) {
+ if shirabe_php_shim::is_string(&input) {
return Ok(input);
}
- if php::is_scalar(&input) {
+ if shirabe_php_shim::is_scalar(&input) {
let s = match &input {
PhpMixed::Bool(b) => {
if *b {
diff --git a/crates/shirabe-external-packages/src/symfony/string/mod.rs b/crates/shirabe-external-packages/src/symfony/string.rs
index 139d726..139d726 100644
--- a/crates/shirabe-external-packages/src/symfony/string/mod.rs
+++ b/crates/shirabe-external-packages/src/symfony/string.rs
diff --git a/crates/shirabe-semver/src/compiling_matcher.rs b/crates/shirabe-semver/src/compiling_matcher.rs
index 1d980e7..142fd0d 100644
--- a/crates/shirabe-semver/src/compiling_matcher.rs
+++ b/crates/shirabe-semver/src/compiling_matcher.rs
@@ -1,12 +1,10 @@
//! ref: composer/vendor/composer/semver/src/CompilingMatcher.php
-use std::sync::Mutex;
-use std::sync::OnceLock;
-
-use indexmap::IndexMap;
-
use crate::constraint::AnyConstraint;
use crate::constraint::SimpleConstraint;
+use indexmap::IndexMap;
+use std::sync::Mutex;
+use std::sync::OnceLock;
static COMPILED_CHECKER_CACHE: OnceLock<
Mutex<IndexMap<String, Box<dyn Fn(String, bool) -> bool + Send + Sync>>>,
diff --git a/crates/shirabe-semver/src/constraint/bound.rs b/crates/shirabe-semver/src/constraint/bound.rs
index 8e45023..2590424 100644
--- a/crates/shirabe-semver/src/constraint/bound.rs
+++ b/crates/shirabe-semver/src/constraint/bound.rs
@@ -2,8 +2,6 @@
use anyhow::bail;
-use shirabe_php_shim as php;
-
#[derive(Debug, Clone, PartialEq)]
pub struct Bound {
version: String,
@@ -43,7 +41,8 @@ impl Bound {
return Ok(false);
}
- let compare_result = php::version_compare_2(self.get_version(), other.get_version());
+ let compare_result =
+ shirabe_php_shim::version_compare_2(self.get_version(), other.get_version());
if compare_result != 0 {
return Ok((if operator == ">" { 1 } else { -1 }) == compare_result);
diff --git a/crates/shirabe-semver/src/constraint/simple_constraint.rs b/crates/shirabe-semver/src/constraint/simple_constraint.rs
index 161425a..5a85382 100644
--- a/crates/shirabe-semver/src/constraint/simple_constraint.rs
+++ b/crates/shirabe-semver/src/constraint/simple_constraint.rs
@@ -1,9 +1,7 @@
//! ref: composer/vendor/composer/semver/src/Constraint/Constraint.php
-use anyhow::bail;
-use shirabe_php_shim as php;
-
use crate::constraint::Bound;
+use anyhow::bail;
/// Corresponds to PHP's `Constraint`.
#[derive(Debug, Clone)]
@@ -120,24 +118,33 @@ impl SimpleConstraint {
return Ok(false);
}
- Ok(php::version_compare(a, b, operator))
+ Ok(shirabe_php_shim::version_compare(a, b, operator))
}
pub fn compile_constraint(&self, other_operator: i64) -> String {
if self.version.starts_with("dev-") {
if Self::OP_EQ == self.operator {
if Self::OP_EQ == other_operator {
- return format!("$b && $v === {}", php::var_export_str(&self.version, true));
+ return format!(
+ "$b && $v === {}",
+ shirabe_php_shim::var_export_str(&self.version, true)
+ );
}
if Self::OP_NE == other_operator {
- return format!("!$b || $v !== {}", php::var_export_str(&self.version, true));
+ return format!(
+ "!$b || $v !== {}",
+ shirabe_php_shim::var_export_str(&self.version, true)
+ );
}
return "false".to_string();
}
if Self::OP_NE == self.operator {
if Self::OP_EQ == other_operator {
- return format!("!$b || $v !== {}", php::var_export_str(&self.version, true));
+ return format!(
+ "!$b || $v !== {}",
+ shirabe_php_shim::var_export_str(&self.version, true)
+ );
}
if Self::OP_NE == other_operator {
return "true".to_string();
@@ -152,18 +159,18 @@ impl SimpleConstraint {
if Self::OP_EQ == other_operator {
return format!(
"\\version_compare($v, {}, '==')",
- php::var_export_str(&self.version, true)
+ shirabe_php_shim::var_export_str(&self.version, true)
);
}
if Self::OP_NE == other_operator {
return format!(
"$b || \\version_compare($v, {}, '!=')",
- php::var_export_str(&self.version, true)
+ shirabe_php_shim::var_export_str(&self.version, true)
);
}
return format!(
"!$b && \\version_compare({}, $v, '{}')",
- php::var_export_str(&self.version, true),
+ shirabe_php_shim::var_export_str(&self.version, true),
Self::trans_op_int(other_operator)
);
}
@@ -172,7 +179,7 @@ impl SimpleConstraint {
if Self::OP_EQ == other_operator {
return format!(
"$b || (!$b && \\version_compare($v, {}, '!='))",
- php::var_export_str(&self.version, true)
+ shirabe_php_shim::var_export_str(&self.version, true)
);
}
if Self::OP_NE == other_operator {
@@ -195,14 +202,14 @@ impl SimpleConstraint {
let code_comparison = format!(
"\\version_compare($v, {}, '{}')",
- php::var_export_str(&self.version, true),
+ shirabe_php_shim::var_export_str(&self.version, true),
Self::trans_op_int(self.operator)
);
if self.operator == Self::OP_LE && other_operator == Self::OP_GT {
return format!(
"!$b && \\version_compare($v, {}, '!=') && {}",
- php::var_export_str(&self.version, true),
+ shirabe_php_shim::var_export_str(&self.version, true),
code_comparison
);
}
@@ -210,7 +217,7 @@ impl SimpleConstraint {
if self.operator == Self::OP_GE && other_operator == Self::OP_LT {
return format!(
"!$b && \\version_compare($v, {}, '!=') && {}",
- php::var_export_str(&self.version, true),
+ shirabe_php_shim::var_export_str(&self.version, true),
code_comparison
);
}
@@ -273,7 +280,7 @@ impl SimpleConstraint {
{
return !(Self::trans_op_int(provider.operator) == provider_no_equal_op
&& Self::trans_op_int(self.operator) != no_equal_op
- && php::version_compare(&provider.version, &self.version, "=="));
+ && shirabe_php_shim::version_compare(&provider.version, &self.version, "=="));
}
false
diff --git a/crates/shirabe-semver/src/intervals.rs b/crates/shirabe-semver/src/intervals.rs
index 68b23bf..862b3ad 100644
--- a/crates/shirabe-semver/src/intervals.rs
+++ b/crates/shirabe-semver/src/intervals.rs
@@ -1,15 +1,13 @@
//! ref: composer/vendor/composer/semver/src/Intervals.php
-use std::collections::HashMap;
-use std::sync::{Mutex, OnceLock};
-
use crate::constraint::AnyConstraint;
use crate::constraint::MatchAllConstraint;
use crate::constraint::MatchNoneConstraint;
use crate::constraint::MultiConstraint;
use crate::constraint::SimpleConstraint;
use crate::interval::{DevConstraintSet, Interval};
-use shirabe_php_shim as php;
+use indexmap::IndexMap;
+use std::sync::{Mutex, OnceLock};
#[derive(Debug, Clone)]
pub struct IntervalCollection {
@@ -17,10 +15,10 @@ pub struct IntervalCollection {
pub branches: DevConstraintSet,
}
-static INTERVALS_CACHE: OnceLock<Mutex<HashMap<String, IntervalCollection>>> = OnceLock::new();
+static INTERVALS_CACHE: OnceLock<Mutex<IndexMap<String, IntervalCollection>>> = OnceLock::new();
-fn intervals_cache() -> &'static Mutex<HashMap<String, IntervalCollection>> {
- INTERVALS_CACHE.get_or_init(|| Mutex::new(HashMap::new()))
+fn intervals_cache() -> &'static Mutex<IndexMap<String, IntervalCollection>> {
+ INTERVALS_CACHE.get_or_init(|| Mutex::new(IndexMap::new()))
}
fn op_sort_order(op: &str) -> i64 {
@@ -38,7 +36,7 @@ pub struct Intervals;
impl Intervals {
pub fn clear() {
- *intervals_cache().lock().unwrap() = HashMap::new();
+ *intervals_cache().lock().unwrap() = IndexMap::new();
}
pub fn is_subset_of(
@@ -418,7 +416,7 @@ impl Intervals {
branches
};
- branches.names = php::array_unique(&branches.names);
+ branches.names = shirabe_php_shim::array_unique(&branches.names);
if numeric_groups.len() == 1 {
return Ok(IntervalCollection {
@@ -445,7 +443,7 @@ impl Intervals {
}
borders.sort_by(|a, b| {
- let order = php::version_compare_2(&a.0, &b.0);
+ let order = shirabe_php_shim::version_compare_2(&a.0, &b.0);
if order == 0 {
let diff = op_sort_order(&a.1) - op_sort_order(&b.1);
diff.cmp(&0)
@@ -479,7 +477,7 @@ impl Intervals {
} else if start.is_some() && active_intervals < activation_threshold {
let start_c = start.take().unwrap();
// filter out invalid intervals like > x - <= x, or >= x - < x
- if php::version_compare(start_c.get_version(), version, "=")
+ if shirabe_php_shim::version_compare(start_c.get_version(), version, "=")
&& ((start_c.get_operator() == ">" && operator == "<=")
|| (start_c.get_operator() == ">=" && operator == "<"))
{
diff --git a/crates/shirabe-semver/src/semver.rs b/crates/shirabe-semver/src/semver.rs
index 4700ac4..10814d4 100644
--- a/crates/shirabe-semver/src/semver.rs
+++ b/crates/shirabe-semver/src/semver.rs
@@ -1,10 +1,9 @@
//! ref: composer/vendor/composer/semver/src/Semver.php
-use std::sync::OnceLock;
-
use crate::comparator::Comparator;
use crate::constraint::SimpleConstraint;
use crate::version_parser::VersionParser;
+use std::sync::OnceLock;
pub struct Semver;
diff --git a/crates/shirabe-semver/src/version_parser.rs b/crates/shirabe-semver/src/version_parser.rs
index 53ddbe8..ac3aec8 100644
--- a/crates/shirabe-semver/src/version_parser.rs
+++ b/crates/shirabe-semver/src/version_parser.rs
@@ -4,7 +4,6 @@ use crate::constraint::AnyConstraint;
use crate::constraint::MatchAllConstraint;
use crate::constraint::MultiConstraint;
use crate::constraint::SimpleConstraint;
-use shirabe_php_shim as php;
// Regex to match pre-release data (sort of).
//
@@ -25,16 +24,16 @@ pub struct VersionParser;
impl VersionParser {
pub fn parse_stability(version: &str) -> String {
- let version = php::preg_replace("{#.+$}", "", version);
+ let version = shirabe_php_shim::preg_replace("{#.+$}", "", version);
if version.starts_with("dev-") || version.ends_with("-dev") {
return "dev".to_string();
}
let pattern = format!("{{{}(?:\\+.*)?$}}i", MODIFIER_REGEX);
- let lower = php::strtolower(&version);
+ let lower = shirabe_php_shim::strtolower(&version);
let mut match_: Vec<Option<String>> = Vec::new();
- php::preg_match(&pattern, &lower, &mut match_);
+ shirabe_php_shim::preg_match(&pattern, &lower, &mut match_);
// match_[3] = the ([.-]?dev)? capture
if match_
@@ -63,7 +62,7 @@ impl VersionParser {
}
pub fn normalize_stability(stability: &str) -> anyhow::Result<String> {
- let stability = php::strtolower(stability);
+ let stability = shirabe_php_shim::strtolower(stability);
if !["stable", "rc", "beta", "alpha", "dev"].contains(&stability.as_str()) {
anyhow::bail!(
@@ -80,21 +79,22 @@ impl VersionParser {
}
pub fn normalize(&self, version: &str, full_version: Option<&str>) -> anyhow::Result<String> {
- let version = php::trim(version, None);
+ let version = shirabe_php_shim::trim(version, None);
let orig_version = version.clone();
let full_version = full_version.unwrap_or(&version).to_string();
let mut version = version;
// strip off aliasing
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match("{^([^,\\s]++) ++as ++([^,\\s]++)$}", &version, &mut match_) {
+ if shirabe_php_shim::preg_match("{^([^,\\s]++) ++as ++([^,\\s]++)$}", &version, &mut match_)
+ {
version = match_[1].clone().unwrap_or_default();
}
// strip off stability flag
let stab_pattern = format!("{{@(?:{})$}}i", STABILITIES_REGEX);
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match(&stab_pattern, &version, &mut match_) {
+ if shirabe_php_shim::preg_match(&stab_pattern, &version, &mut match_) {
let match0_len = match_[0].as_deref().unwrap_or("").len();
version = version[..version.len() - match0_len].to_string();
}
@@ -112,7 +112,7 @@ impl VersionParser {
// strip off build metadata
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match("{^([^,\\s+]++)\\+[^\\s]++$}", &version, &mut match_) {
+ if shirabe_php_shim::preg_match("{^([^,\\s+]++)\\+[^\\s]++$}", &version, &mut match_) {
version = match_[1].clone().unwrap_or_default();
}
@@ -124,7 +124,7 @@ impl VersionParser {
"{{^v?(\\d{{1,5}}+)(\\.\\d++)?(\\.\\d++)?(\\.\\d++)?{}$}}i",
MODIFIER_REGEX
);
- if php::preg_match(&classical_pattern, &version, &mut matches) {
+ if shirabe_php_shim::preg_match(&classical_pattern, &version, &mut matches) {
let m2 = matches[2].as_deref().unwrap_or("");
let m3 = matches[3].as_deref().unwrap_or("");
let m4 = matches[4].as_deref().unwrap_or("");
@@ -142,8 +142,12 @@ impl VersionParser {
"{{^v?(\\d{{4}}(?:[.:-]?\\d{{2}}){{1,6}}(?:[.:-]?\\d{{1,3}}){{0,2}}){}$}}i",
MODIFIER_REGEX
);
- if php::preg_match(&datetime_pattern, &version, &mut matches) {
- version = php::preg_replace("{\\D}", ".", matches[1].as_deref().unwrap_or(""));
+ if shirabe_php_shim::preg_match(&datetime_pattern, &version, &mut matches) {
+ version = shirabe_php_shim::preg_replace(
+ "{\\D}",
+ ".",
+ matches[1].as_deref().unwrap_or(""),
+ );
index = Some(2);
}
}
@@ -185,7 +189,7 @@ impl VersionParser {
// match dev branches
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match("{(.*?)[.-]?dev$}i", &version, &mut match_) {
+ if shirabe_php_shim::preg_match("{(.*?)[.-]?dev$}i", &version, &mut match_) {
let branch_name = match_[1].clone().unwrap_or_default();
// a branch ending with -dev is only valid if it is numeric
// if it gets prefixed with dev- it means the branch name should
@@ -197,10 +201,10 @@ impl VersionParser {
}
}
- let extra_message = if php::preg_match(
+ let extra_message = if shirabe_php_shim::preg_match(
&format!(
"{{ +as +{}(?:@(?:{}))?$}}",
- php::preg_quote(&version, None),
+ shirabe_php_shim::preg_quote(&version, None),
STABILITIES_REGEX
),
&full_version,
@@ -210,10 +214,10 @@ impl VersionParser {
" in \"{}\", the alias must be an exact version",
full_version
)
- } else if php::preg_match(
+ } else if shirabe_php_shim::preg_match(
&format!(
"{{^{}(?:@(?:{}))? +as +}}",
- php::preg_quote(&version, None),
+ shirabe_php_shim::preg_quote(&version, None),
STABILITIES_REGEX
),
&full_version,
@@ -238,7 +242,7 @@ impl VersionParser {
pub fn parse_numeric_alias_prefix(&self, branch: &str) -> Option<String> {
let mut matches: Vec<Option<String>> = Vec::new();
// matches['version'] == matches[1] ((?P<version>...) is group 1)
- if php::preg_match(
+ if shirabe_php_shim::preg_match(
"{^(?P<version>(\\d++\\.)*\\d++)(?:\\.x)?-dev$}i",
branch,
&mut matches,
@@ -251,13 +255,13 @@ impl VersionParser {
}
pub fn normalize_branch(&self, name: &str) -> anyhow::Result<String> {
- let name = php::trim(name, None);
+ let name = shirabe_php_shim::trim(name, None);
let mut matches: Vec<Option<String>> = Vec::new();
// Groups: 1=major, 2=".minor"(outer), 3=minor(inner), 4=".patch"(outer),
// 5=patch(inner), 6=".fourth"(outer), 7=fourth(inner).
// We use the outer groups [1,2,4,6] to replicate PHP's groups [1,2,3,4].
- if php::preg_match(
+ if shirabe_php_shim::preg_match(
"{^v?(\\d++)(\\.(\\d++|[xX*]))?(\\.(\\d++|[xX*]))?(\\.(\\d++|[xX*]))?$}i",
&name,
&mut matches,
@@ -292,7 +296,10 @@ impl VersionParser {
pub fn parse_constraints(&self, constraints: &str) -> anyhow::Result<AnyConstraint> {
let pretty_constraint = constraints.to_string();
- let or_constraints = php::preg_split("{\\s*\\|\\|?\\s*}", &php::trim(constraints, None));
+ let or_constraints = shirabe_php_shim::preg_split(
+ "{\\s*\\|\\|?\\s*}",
+ &shirabe_php_shim::trim(constraints, None),
+ );
let mut or_groups: Vec<AnyConstraint> = Vec::new();
@@ -330,7 +337,7 @@ impl VersionParser {
// strip off aliasing
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match(
+ if shirabe_php_shim::preg_match(
"{^([^,\\s]++) ++as ++([^,\\s]++)$}",
&constraint,
&mut match_,
@@ -342,7 +349,7 @@ impl VersionParser {
let mut stability_modifier: Option<String> = None;
let mut match_: Vec<Option<String>> = Vec::new();
let stab_pattern = format!("{{^([^,\\s]*?)@({})$}}i", STABILITIES_REGEX);
- if php::preg_match(&stab_pattern, &constraint, &mut match_) {
+ if shirabe_php_shim::preg_match(&stab_pattern, &constraint, &mut match_) {
let m1 = match_[1].as_deref().unwrap_or("");
constraint = if !m1.is_empty() {
m1.to_string()
@@ -357,7 +364,7 @@ impl VersionParser {
// get rid of #refs as those are used by composer only
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match(
+ if shirabe_php_shim::preg_match(
"{^(dev-[^,\\s@]+?|[^,\\s@]+?\\.x-dev)#.+$}i",
&constraint,
&mut match_,
@@ -366,7 +373,7 @@ impl VersionParser {
}
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match("{^(v)?[xX*](\\.[xX*])*$}i", &constraint, &mut match_) {
+ if shirabe_php_shim::preg_match("{^(v)?[xX*](\\.[xX*])*$}i", &constraint, &mut match_) {
let m1_nonempty = !match_
.get(1)
.and_then(|o| o.as_deref())
@@ -401,7 +408,7 @@ impl VersionParser {
// the current version is used instead.
let mut matches: Vec<Option<String>> = Vec::new();
let tilde_pattern = format!("{{^~>?{}$}}i", version_regex);
- if php::preg_match(&tilde_pattern, &constraint, &mut matches) {
+ if shirabe_php_shim::preg_match(&tilde_pattern, &constraint, &mut matches) {
if constraint.starts_with("~>") {
anyhow::bail!(
"Could not parse version constraint {}: Invalid operator \"~>\", you probably \
@@ -464,7 +471,7 @@ impl VersionParser {
// and above, patch updates for versions 0.X >=0.1.0, and no updates for versions 0.0.X
let mut matches: Vec<Option<String>> = Vec::new();
let caret_pattern = format!("{{^\\^{}($)}}i", version_regex);
- if php::preg_match(&caret_pattern, &constraint, &mut matches) {
+ if shirabe_php_shim::preg_match(&caret_pattern, &constraint, &mut matches) {
// Work out which position in the version we are operating at
let m1 = matches[1].as_deref().unwrap_or("");
let m2 = matches[2].as_deref().unwrap_or("");
@@ -512,7 +519,7 @@ impl VersionParser {
// [major, minor, patch] tuple. A partial version range is treated as an X-Range, so the
// special character is in fact optional.
let mut matches: Vec<Option<String>> = Vec::new();
- if php::preg_match(
+ if shirabe_php_shim::preg_match(
"{^v?(\\d++)(?:\\.(\\d++))?(?:\\.(\\d++))?(?:\\.[xX*])++$}",
&constraint,
&mut matches,
@@ -562,7 +569,7 @@ impl VersionParser {
"{{^(?P<from>{}) +- +(?P<to>{})($)}}i",
version_regex, version_regex
);
- if php::preg_match(&hyphen_pattern, &constraint, &mut matches) {
+ if shirabe_php_shim::preg_match(&hyphen_pattern, &constraint, &mut matches) {
// matches[1]='from' string, matches[2..9]=from captures, matches[10]='to' string,
// matches[11..18]=to captures, matches[19]='($)'
// matches[6]=from stability, matches[8]=from dev, matches[9]=from wildcard-dev
@@ -628,7 +635,8 @@ impl VersionParser {
// Basic Comparators
let mut match_: Vec<Option<String>> = Vec::new();
- if php::preg_match("{^(<>|!=|>=?|<=?|==?)?\\s*(.*)}", &constraint, &mut match_) {
+ if shirabe_php_shim::preg_match("{^(<>|!=|>=?|<=?|==?)?\\s*(.*)}", &constraint, &mut match_)
+ {
let version_str = match_[2].clone().unwrap_or_default();
let op_str = match_[1].clone().unwrap_or_default();
@@ -639,7 +647,11 @@ impl VersionParser {
// dev-foobar except if the constraint uses a known operator, in which
// case it must be a parse error
if version_str.ends_with("-dev")
- && php::preg_match("{^[0-9a-zA-Z-./]+$}", &version_str, &mut Vec::new())
+ && shirabe_php_shim::preg_match(
+ "{^[0-9a-zA-Z-./]+$}",
+ &version_str,
+ &mut Vec::new(),
+ )
{
self.normalize(
&format!("dev-{}", &version_str[..version_str.len() - 4]),
@@ -664,9 +676,9 @@ impl VersionParser {
}
if op == "<" || op == ">=" {
let modifier_pattern = format!("{{-{}$}}", MODIFIER_REGEX);
- if !php::preg_match(
+ if !shirabe_php_shim::preg_match(
&modifier_pattern,
- &php::strtolower(&version_str),
+ &shirabe_php_shim::strtolower(&version_str),
&mut Vec::new(),
) && !version_str.starts_with("dev-")
{
diff --git a/crates/shirabe/src/advisory/mod.rs b/crates/shirabe/src/advisory.rs
index dbb90bd..dbb90bd 100644
--- a/crates/shirabe/src/advisory/mod.rs
+++ b/crates/shirabe/src/advisory.rs
diff --git a/crates/shirabe/src/advisory/audit_config.rs b/crates/shirabe/src/advisory/audit_config.rs
index 28e5e68..458ebef 100644
--- a/crates/shirabe/src/advisory/audit_config.rs
+++ b/crates/shirabe/src/advisory/audit_config.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Advisory/AuditConfig.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
-
use crate::advisory::Auditor;
use crate::config::Config;
+use indexmap::IndexMap;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
#[derive(Debug, Clone)]
pub struct AuditConfig {
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs
index 4331b7b..be78f4b 100644
--- a/crates/shirabe/src/advisory/auditor.rs
+++ b/crates/shirabe/src/advisory/auditor.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Advisory/Auditor.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_php_shim::{
- DATE_ATOM, InvalidArgumentException, PhpMixed, array_all, array_any, array_key_exists,
- array_keys, array_reduce, get_class, sprintf, str_starts_with,
-};
-
use crate::advisory::AnySecurityAdvisory;
use crate::advisory::SecurityAdvisory;
use crate::io::ConsoleIO;
@@ -19,6 +10,14 @@ use crate::package::PackageInterfaceHandle;
use crate::package::base_package;
use crate::repository::RepositorySet;
use crate::util::PackageInfo;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_php_shim::{
+ DATE_ATOM, InvalidArgumentException, PhpMixed, array_all, array_any, array_key_exists,
+ array_keys, array_reduce, get_class, sprintf, str_starts_with,
+};
/// Shape of the `--format=json` audit output.
#[derive(serde::Serialize)]
diff --git a/crates/shirabe/src/advisory/security_advisory.rs b/crates/shirabe/src/advisory/security_advisory.rs
index 78a2562..298a9e6 100644
--- a/crates/shirabe/src/advisory/security_advisory.rs
+++ b/crates/shirabe/src/advisory/security_advisory.rs
@@ -1,13 +1,12 @@
//! ref: composer/src/Composer/Advisory/SecurityAdvisory.php
+use crate::advisory::IgnoredSecurityAdvisory;
+use crate::advisory::PartialSecurityAdvisory;
use chrono::{DateTime, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::DATE_RFC3339;
use shirabe_semver::constraint::AnyConstraint;
-use crate::advisory::IgnoredSecurityAdvisory;
-use crate::advisory::PartialSecurityAdvisory;
-
fn serialize_date_rfc3339<S: serde::Serializer>(
dt: &DateTime<Utc>,
serializer: S,
diff --git a/crates/shirabe/src/autoload/mod.rs b/crates/shirabe/src/autoload.rs
index d5758b2..d5758b2 100644
--- a/crates/shirabe/src/autoload/mod.rs
+++ b/crates/shirabe/src/autoload.rs
diff --git a/crates/shirabe/src/autoload/autoload_generator.rs b/crates/shirabe/src/autoload/autoload_generator.rs
index 133348c..e7acb0a 100644
--- a/crates/shirabe/src/autoload/autoload_generator.rs
+++ b/crates/shirabe/src/autoload/autoload_generator.rs
@@ -1,20 +1,5 @@
//! ref: composer/src/Composer/Autoload/AutoloadGenerator.php
-use indexmap::IndexMap;
-
-use shirabe_class_map_generator::class_map::ClassMap;
-use shirabe_class_map_generator::class_map_generator::ClassMapGenerator;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, array_keys, array_map, array_merge_map,
- array_merge_recursive, array_shift, array_slice_strs, array_unique, bin2hex, explode,
- file_exists, file_get_contents, hash, implode, is_array, ksort, ltrim, preg_quote,
- random_bytes, realpath, str_contains, str_replace, str_starts_with, strlen, strpos, strtr,
- substr, substr_count, trim, unlink, var_export,
-};
-use shirabe_semver::constraint::Bound;
-
use crate::autoload::ClassLoader;
use crate::config::Config;
use crate::event_dispatcher::EventDispatcher;
@@ -34,6 +19,19 @@ use crate::script::ScriptEvents;
use crate::util::Filesystem;
use crate::util::PackageSorter;
use crate::util::Platform;
+use indexmap::IndexMap;
+use shirabe_class_map_generator::class_map::ClassMap;
+use shirabe_class_map_generator::class_map_generator::ClassMapGenerator;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, array_keys, array_map, array_merge_map,
+ array_merge_recursive, array_shift, array_slice_strs, array_unique, bin2hex, explode,
+ file_exists, file_get_contents, hash, implode, is_array, ksort, ltrim, preg_quote,
+ random_bytes, realpath, str_contains, str_replace, str_starts_with, strlen, strpos, strtr,
+ substr, substr_count, trim, unlink, var_export,
+};
+use shirabe_semver::constraint::Bound;
#[derive(Debug)]
pub struct AutoloadGenerator {
diff --git a/crates/shirabe/src/autoload/class_loader.rs b/crates/shirabe/src/autoload/class_loader.rs
index 3889ca0..3ebb7a7 100644
--- a/crates/shirabe/src/autoload/class_loader.rs
+++ b/crates/shirabe/src/autoload/class_loader.rs
@@ -1,13 +1,12 @@
//! ref: composer/src/Composer/Autoload/ClassLoader.php
use indexmap::IndexMap;
-use std::sync::{LazyLock, Mutex};
-
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, InvalidArgumentException, PhpMixed, defined, file_exists, include_file,
spl_autoload_register, spl_autoload_unregister, stream_resolve_include_path, strlen, strpos,
strrpos, strtr, substr,
};
+use std::sync::{LazyLock, Mutex};
/// @var array<string, self>
static REGISTERED_LOADERS: LazyLock<Mutex<IndexMap<String, ClassLoader>>> =
diff --git a/crates/shirabe/src/cache.rs b/crates/shirabe/src/cache.rs
index 20197cd..b2e2f3f 100644
--- a/crates/shirabe/src/cache.rs
+++ b/crates/shirabe/src/cache.rs
@@ -1,7 +1,10 @@
//! ref: composer/src/Composer/Cache.php
-use std::sync::Mutex;
-
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
+use crate::util::Filesystem;
+use crate::util::Platform;
+use crate::util::Silencer;
use anyhow::Result;
use chrono::Utc;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -11,12 +14,7 @@ use shirabe_php_shim::{
file_exists, file_get_contents, file_put_contents, filemtime, function_exists, hash_file,
is_dir, is_writable, mkdir, random_bytes, random_int, rename, time, unlink,
};
-
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::util::Filesystem;
-use crate::util::Platform;
-use crate::util::Silencer;
+use std::sync::Mutex;
/// Reads/writes to a filesystem cache
#[derive(Debug)]
diff --git a/crates/shirabe/src/command/mod.rs b/crates/shirabe/src/command.rs
index 614fff7..614fff7 100644
--- a/crates/shirabe/src/command/mod.rs
+++ b/crates/shirabe/src/command.rs
diff --git a/crates/shirabe/src/command/about_command.rs b/crates/shirabe/src/command/about_command.rs
index 6aae55d..94c877a 100644
--- a/crates/shirabe/src/command/about_command.rs
+++ b/crates/shirabe/src/command/about_command.rs
@@ -1,5 +1,9 @@
//! ref: composer/src/Composer/Command/AboutCommand.php
+use crate::command::BaseCommand;
+use crate::command::BaseCommandData;
+use crate::command::base_command::base_command_initialize;
+use crate::composer;
use anyhow::Result;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
@@ -7,11 +11,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseCommand;
-use crate::command::BaseCommandData;
-use crate::command::base_command::base_command_initialize;
-use crate::composer;
-
#[derive(Debug)]
pub struct AboutCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/archive_command.rs b/crates/shirabe/src/command/archive_command.rs
index d593912..91e8036 100644
--- a/crates/shirabe/src/command/archive_command.rs
+++ b/crates/shirabe/src/command/archive_command.rs
@@ -1,15 +1,5 @@
//! ref: composer/src/Composer/Command/ArchiveCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{LogicException, get_debug_type};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
use crate::composer::PartialComposerHandle;
@@ -32,6 +22,15 @@ use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::r#loop::Loop;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{LogicException, get_debug_type};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct ArchiveCommand {
diff --git a/crates/shirabe/src/command/audit_command.rs b/crates/shirabe/src/command/audit_command.rs
index 0cf64a3..59d11a6 100644
--- a/crates/shirabe/src/command/audit_command.rs
+++ b/crates/shirabe/src/command/audit_command.rs
@@ -1,15 +1,5 @@
//! ref: composer/src/Composer/Command/AuditCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, UnexpectedValueException, implode, in_array,
-};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::AuditConfig;
use crate::advisory::Auditor;
use crate::command::BaseCommand;
@@ -21,6 +11,15 @@ use crate::io::IOInterfaceImmutable;
use crate::repository::CanonicalPackagesTrait;
use crate::repository::RepositorySet;
use crate::repository::RepositoryUtils;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, UnexpectedValueException, implode, in_array,
+};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct AuditCommand {
diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs
index 149dc09..46ee5f7 100644
--- a/crates/shirabe/src/command/base_command.rs
+++ b/crates/shirabe/src/command/base_command.rs
@@ -1,23 +1,6 @@
//! ref: composer/src/Composer/Command/BaseCommand.php
//! ref: composer/vendor/symfony/console/Command/Command.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::Terminal;
-use shirabe_external_packages::symfony::console::command::command::{
- Command, CommandData, SetDefinitionArg,
-};
-use shirabe_external_packages::symfony::console::helper::Table;
-use shirabe_external_packages::symfony::console::helper::TableSeparator;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, RuntimeException, UnexpectedValueException,
- count, explode, in_array, is_string,
-};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::AuditConfig;
use crate::advisory::Auditor;
use crate::composer::PartialComposerHandle;
@@ -34,6 +17,22 @@ use crate::package::version::VersionParser;
use crate::plugin::PluginEvents;
use crate::plugin::PreCommandRunEvent;
use crate::util::Platform;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::Terminal;
+use shirabe_external_packages::symfony::console::command::command::{
+ Command, CommandData, SetDefinitionArg,
+};
+use shirabe_external_packages::symfony::console::helper::Table;
+use shirabe_external_packages::symfony::console::helper::TableSeparator;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, UnexpectedValueException,
+ count, explode, in_array, is_string,
+};
+use std::cell::RefCell;
+use std::rc::Rc;
pub const SUCCESS: i64 = 0;
pub const FAILURE: i64 = 1;
diff --git a/crates/shirabe/src/command/base_dependency_command.rs b/crates/shirabe/src/command/base_dependency_command.rs
index 1c48a06..8b4fb14 100644
--- a/crates/shirabe/src/command/base_dependency_command.rs
+++ b/crates/shirabe/src/command/base_dependency_command.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Command/BaseDependencyCommand.php
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, UnexpectedValueException};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::Bound;
-
use crate::command::BaseCommand;
use crate::io::IOInterfaceImmutable;
use crate::package::Package;
@@ -22,6 +13,14 @@ use crate::repository::RootPackageRepository;
use crate::repository::{DependentsEntry, InstalledRepository, NeedleInput};
use crate::repository::{FindPackageConstraint, RepositoryInterface};
use crate::util::PackageInfo;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, UnexpectedValueException};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::Bound;
pub const ARGUMENT_PACKAGE: &str = "package";
pub const ARGUMENT_CONSTRAINT: &str = "version";
diff --git a/crates/shirabe/src/command/bump_command.rs b/crates/shirabe/src/command/bump_command.rs
index 3964300..79fedfb 100644
--- a/crates/shirabe/src/command/bump_command.rs
+++ b/crates/shirabe/src/command/bump_command.rs
@@ -1,16 +1,5 @@
//! ref: composer/src/Composer/Command/BumpCommand.php
-use crate::io::io_interface;
-use crate::package::base_package;
-use anyhow::Result;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{PhpMixed, file_get_contents, file_put_contents, is_writable, strtolower};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
use crate::console::input::InputArgument;
@@ -18,12 +7,22 @@ use crate::console::input::InputOption;
use crate::factory::Factory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonFile;
use crate::json::JsonManipulator;
+use crate::package::base_package;
use crate::package::version::VersionBumper;
use crate::repository::PlatformRepository;
use crate::util::Filesystem;
use crate::util::Silencer;
+use anyhow::Result;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{PhpMixed, file_get_contents, file_put_contents, is_writable, strtolower};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct BumpCommand {
@@ -180,7 +179,7 @@ impl BumpCommand {
let unique_lower: Vec<String> = packages_filter
.iter()
.map(|s| strtolower(s))
- .collect::<std::collections::HashSet<_>>()
+ .collect::<indexmap::IndexSet<_>>()
.into_iter()
.collect();
let pattern = base_package::package_names_to_regexp(&unique_lower, "{^(?:%s)$}iD");
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs
index ee98aa8..4b4e043 100644
--- a/crates/shirabe/src/command/check_platform_reqs_command.rs
+++ b/crates/shirabe/src/command/check_platform_reqs_command.rs
@@ -1,16 +1,5 @@
//! ref: composer/src/Composer/Command/CheckPlatformReqsCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{PhpMixed, array_merge_map, strip_tags};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
use crate::console::input::InputOption;
@@ -21,6 +10,16 @@ use crate::repository::InstalledRepository;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterface;
use crate::repository::RootPackageRepository;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{PhpMixed, array_merge_map, strip_tags};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
+use std::cell::RefCell;
+use std::rc::Rc;
struct CheckResult {
platform_package: String,
diff --git a/crates/shirabe/src/command/clear_cache_command.rs b/crates/shirabe/src/command/clear_cache_command.rs
index abe72ec..696b1dc 100644
--- a/crates/shirabe/src/command/clear_cache_command.rs
+++ b/crates/shirabe/src/command/clear_cache_command.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Command/ClearCacheCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::realpath;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::cache::Cache;
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
@@ -16,6 +8,13 @@ use crate::config::Config;
use crate::console::input::InputOption;
use crate::factory::Factory;
use crate::io::IOInterfaceImmutable;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::realpath;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct ClearCacheCommand {
diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs
index 7bf7d1b..e1ebf1a 100644
--- a/crates/shirabe/src/command/config_command.rs
+++ b/crates/shirabe/src/command/config_command.rs
@@ -1,21 +1,5 @@
//! ref: composer/src/Composer/Command/ConfigCommand.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-
-use crate::console::input::InputOption;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge,
- escapeshellcmd, exec, explode, file_exists, file_get_contents, implode, in_array, is_array,
- is_bool, is_dir, is_numeric, is_object, is_string, json_encode, str_replace, strpos,
- strtolower, system, touch, var_export,
-};
-
use crate::advisory::Auditor;
use crate::command::BaseConfigCommand;
use crate::command::{BaseCommand, BaseCommandData};
@@ -23,13 +7,27 @@ use crate::config::Config;
use crate::config::ConfigSourceInterface;
use crate::config::JsonConfigSource;
use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonEncodeOptions;
use crate::json::JsonFile;
use crate::package::base_package::{self};
use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::Silencer;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge,
+ escapeshellcmd, exec, explode, file_exists, file_get_contents, implode, in_array, is_array,
+ is_bool, is_dir, is_numeric, is_object, is_string, json_encode, str_replace, strpos,
+ strtolower, system, touch, var_export,
+};
use shirabe_semver::VersionParser;
#[derive(Debug)]
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index abbf37a..8f01f98 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -1,22 +1,5 @@
//! ref: composer/src/Composer/Command/CreateProjectCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::seld::signal::SignalHandler;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_external_packages::symfony::finder::Finder;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, InvalidArgumentException, PhpMixed, RuntimeException,
- UnexpectedValueException, array_pop, chdir, explode_with_limit, file_exists, getcwd, implode,
- is_dir, is_file, mkdir, realpath, rtrim, strtolower, unlink,
-};
-use std::cell::RefCell;
-use std::path::PathBuf;
-use std::rc::Rc;
-
use crate::advisory::Auditor;
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
@@ -49,6 +32,22 @@ use crate::script::ScriptEvents;
use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::seld::signal::SignalHandler;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_external_packages::symfony::finder::Finder;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, InvalidArgumentException, PhpMixed, RuntimeException,
+ UnexpectedValueException, array_pop, chdir, explode_with_limit, file_exists, getcwd, implode,
+ is_dir, is_file, mkdir, realpath, rtrim, strtolower, unlink,
+};
+use std::cell::RefCell;
+use std::path::PathBuf;
+use std::rc::Rc;
/// Install a package as new project into new directory.
#[derive(Debug)]
diff --git a/crates/shirabe/src/command/depends_command.rs b/crates/shirabe/src/command/depends_command.rs
index fa60a42..39e916a 100644
--- a/crates/shirabe/src/command/depends_command.rs
+++ b/crates/shirabe/src/command/depends_command.rs
@@ -1,18 +1,17 @@
//! ref: composer/src/Composer/Command/DependsCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::BaseDependencyCommand;
use crate::command::base_command::base_command_initialize;
use crate::console::input::InputArgument;
use crate::console::input::InputOption;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct DependsCommand {
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs
index 0bdf8ef..656f730 100644
--- a/crates/shirabe/src/command/diagnose_command.rs
+++ b/crates/shirabe/src/command/diagnose_command.rs
@@ -1,25 +1,5 @@
//! ref: composer/src/Composer/Command/DiagnoseCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_external_packages::symfony::process::ExecutableFinder;
-use shirabe_php_shim::{
- INFO_GENERAL, InvalidArgumentException, OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT,
- PHP_BINARY, PHP_EOL, PHP_VERSION, PHP_VERSION_ID, PHP_WINDOWS_VERSION_BUILD, PhpMixed, defined,
- disk_free_space, extension_loaded, file_exists, filter_var_boolean, function_exists,
- get_class_err, hash, implode, ini_get, ioncube_loader_iversion, ioncube_loader_version,
- is_array, is_string, ob_get_clean, ob_start, phpinfo, rtrim, str_contains, str_replace,
- str_starts_with, strpos, strstr, strtolower, trim, version_compare,
-};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::Auditor;
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
@@ -52,6 +32,24 @@ use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::http::ProxyManager;
use crate::util::http::RequestProxy;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_external_packages::symfony::process::ExecutableFinder;
+use shirabe_php_shim::{
+ INFO_GENERAL, InvalidArgumentException, OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT,
+ PHP_BINARY, PHP_EOL, PHP_VERSION, PHP_VERSION_ID, PHP_WINDOWS_VERSION_BUILD, PhpMixed, defined,
+ disk_free_space, extension_loaded, file_exists, filter_var_boolean, function_exists,
+ get_class_err, hash, implode, ini_get, ioncube_loader_iversion, ioncube_loader_version,
+ is_array, is_string, ob_get_clean, ob_start, phpinfo, rtrim, str_contains, str_replace,
+ str_starts_with, strpos, strstr, strtolower, trim, version_compare,
+};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct DiagnoseCommand {
diff --git a/crates/shirabe/src/command/dump_autoload_command.rs b/crates/shirabe/src/command/dump_autoload_command.rs
index b0bb755..baae79d 100644
--- a/crates/shirabe/src/command/dump_autoload_command.rs
+++ b/crates/shirabe/src/command/dump_autoload_command.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Command/DumpAutoloadCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, file_exists};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -15,6 +7,13 @@ use crate::console::input::InputOption;
use crate::io::IOInterfaceImmutable;
use crate::plugin::CommandEvent;
use crate::plugin::PluginEvents;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, file_exists};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct DumpAutoloadCommand {
diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs
index 8f3a0b5..8b7d5f7 100644
--- a/crates/shirabe/src/command/exec_command.rs
+++ b/crates/shirabe/src/command/exec_command.rs
@@ -1,5 +1,11 @@
//! ref: composer/src/Composer/Command/ExecCommand.php
+use crate::command::BaseCommand;
+use crate::command::BaseCommandData;
+use crate::command::base_command::base_command_initialize;
+use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
+use crate::io::IOInterfaceImmutable;
use anyhow::Result;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
@@ -8,13 +14,6 @@ use shirabe_php_shim::{PhpMixed, RuntimeException, basename, chdir, getcwd, glob
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseCommand;
-use crate::command::BaseCommandData;
-use crate::command::base_command::base_command_initialize;
-use crate::console::input::InputArgument;
-use crate::console::input::InputOption;
-use crate::io::IOInterfaceImmutable;
-
#[derive(Debug)]
pub struct ExecCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/fund_command.rs b/crates/shirabe/src/command/fund_command.rs
index 7e3bf65..ad4f94f 100644
--- a/crates/shirabe/src/command/fund_command.rs
+++ b/crates/shirabe/src/command/fund_command.rs
@@ -1,5 +1,13 @@
//! ref: composer/src/Composer/Command/FundCommand.php
+use crate::command::base_command::base_command_initialize;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::console::input::InputOption;
+use crate::io::IOInterfaceImmutable;
+use crate::json::JsonFile;
+use crate::package::base_package::{self};
+use crate::repository::CompositeRepository;
+use crate::repository::RepositoryInterface;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -13,15 +21,6 @@ use shirabe_semver::constraint::MatchAllConstraint;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::base_command::base_command_initialize;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::console::input::InputOption;
-use crate::io::IOInterfaceImmutable;
-use crate::json::JsonFile;
-use crate::package::base_package::{self};
-use crate::repository::CompositeRepository;
-use crate::repository::RepositoryInterface;
-
#[derive(Debug)]
pub struct FundCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/global_command.rs b/crates/shirabe/src/command/global_command.rs
index d0d8a31..04c2409 100644
--- a/crates/shirabe/src/command/global_command.rs
+++ b/crates/shirabe/src/command/global_command.rs
@@ -1,7 +1,12 @@
//! ref: composer/src/Composer/Command/GlobalCommand.php
-use std::path::Path;
-
+use crate::command::BaseCommand;
+use crate::command::BaseCommandData;
+use crate::command::base_command::base_command_initialize;
+use crate::console::input::InputArgument;
+use crate::factory::Factory;
+use crate::util::Filesystem;
+use crate::util::Platform;
use anyhow::Result;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::command::command::Command;
@@ -12,16 +17,9 @@ use shirabe_external_packages::symfony::console::input::StringInput;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{LogicException, RuntimeException, chdir};
use std::cell::RefCell;
+use std::path::Path;
use std::rc::Rc;
-use crate::command::BaseCommand;
-use crate::command::BaseCommandData;
-use crate::command::base_command::base_command_initialize;
-use crate::console::input::InputArgument;
-use crate::factory::Factory;
-use crate::util::Filesystem;
-use crate::util::Platform;
-
#[derive(Debug)]
pub struct GlobalCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/home_command.rs b/crates/shirabe/src/command/home_command.rs
index bde9fc2..682cb6a 100644
--- a/crates/shirabe/src/command/home_command.rs
+++ b/crates/shirabe/src/command/home_command.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Command/HomeCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::PhpMixed;
-use shirabe_php_shim::filter_var_url;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -20,6 +11,14 @@ use crate::repository::RepositoryFactory;
use crate::repository::RootPackageRepository;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::PhpMixed;
+use shirabe_php_shim::filter_var_url;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct HomeCommand {
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index 88a2934..dc91069 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -1,6 +1,22 @@
//! ref: composer/src/Composer/Command/InitCommand.php
+use crate::command::PackageDiscoveryTrait;
+use crate::command::base_command::base_command_initialize;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::console::input::InputOption;
+use crate::factory::Factory;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::json::JsonFile;
+use crate::json::JsonValidationException;
+use crate::package::base_package::{self};
+use crate::repository::CompositeRepository;
+use crate::repository::PlatformRepository;
+use crate::repository::PlatformRepositoryHandle;
+use crate::repository::RepositoryFactory;
+use crate::util::Filesystem;
+use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -19,23 +35,6 @@ use shirabe_spdx_licenses::SpdxLicenses;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::PackageDiscoveryTrait;
-use crate::command::base_command::base_command_initialize;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::console::input::InputOption;
-use crate::factory::Factory;
-use crate::io::IOInterfaceImmutable;
-use crate::json::JsonFile;
-use crate::json::JsonValidationException;
-use crate::package::base_package::{self};
-use crate::repository::CompositeRepository;
-use crate::repository::PlatformRepository;
-use crate::repository::PlatformRepositoryHandle;
-use crate::repository::RepositoryFactory;
-use crate::util::Filesystem;
-use crate::util::ProcessExecutor;
-use crate::util::Silencer;
-
#[derive(Debug)]
pub struct InitCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/install_command.rs b/crates/shirabe/src/command/install_command.rs
index de0f400..2f782cc 100644
--- a/crates/shirabe/src/command/install_command.rs
+++ b/crates/shirabe/src/command/install_command.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Command/InstallCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::Auditor;
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
@@ -19,6 +11,13 @@ use crate::io::IOInterfaceImmutable;
use crate::plugin::CommandEvent;
use crate::plugin::PluginEvents;
use crate::util::HttpDownloader;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct InstallCommand {
diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs
index cae79e4..c5cdf2a 100644
--- a/crates/shirabe/src/command/licenses_command.rs
+++ b/crates/shirabe/src/command/licenses_command.rs
@@ -1,5 +1,16 @@
//! ref: composer/src/Composer/Command/LicensesCommand.php
+use crate::command::base_command::base_command_initialize;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::console::input::InputOption;
+use crate::io::IOInterfaceImmutable;
+use crate::json::JsonFile;
+use crate::plugin::CommandEvent;
+use crate::plugin::PluginEvents;
+use crate::repository::RepositoryInterface;
+use crate::repository::RepositoryUtils;
+use crate::util::PackageInfo;
+use crate::util::PackageSorter;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::console::command::command::Command;
@@ -13,18 +24,6 @@ use shirabe_php_shim::{PhpMixed, RuntimeException, UnexpectedValueException};
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::base_command::base_command_initialize;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::console::input::InputOption;
-use crate::io::IOInterfaceImmutable;
-use crate::json::JsonFile;
-use crate::plugin::CommandEvent;
-use crate::plugin::PluginEvents;
-use crate::repository::RepositoryInterface;
-use crate::repository::RepositoryUtils;
-use crate::util::PackageInfo;
-use crate::util::PackageSorter;
-
#[derive(Debug)]
pub struct LicensesCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/outdated_command.rs b/crates/shirabe/src/command/outdated_command.rs
index 90c0f3d..be921e1 100644
--- a/crates/shirabe/src/command/outdated_command.rs
+++ b/crates/shirabe/src/command/outdated_command.rs
@@ -1,5 +1,10 @@
//! ref: composer/src/Composer/Command/OutdatedCommand.php
+use crate::command::BaseCommand;
+use crate::command::BaseCommandData;
+use crate::command::base_command::base_command_initialize;
+use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::console::command::command::Command;
@@ -10,12 +15,6 @@ use shirabe_php_shim::PhpMixed;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseCommand;
-use crate::command::BaseCommandData;
-use crate::command::base_command::base_command_initialize;
-use crate::console::input::InputArgument;
-use crate::console::input::InputOption;
-
#[derive(Debug)]
pub struct OutdatedCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs
index 4a5c65b..c3f744c 100644
--- a/crates/shirabe/src/command/package_discovery_trait.rs
+++ b/crates/shirabe/src/command/package_discovery_trait.rs
@@ -1,24 +1,12 @@
//! ref: composer/src/Composer/Command/PackageDiscoveryTrait.php
-use crate::io::io_interface;
-
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys,
- array_slice, asort, explode, file_get_contents, implode, in_array, is_array, is_file,
- is_numeric, json_decode, levenshtein, strlen, strpos, trim,
-};
-
use crate::command::BaseCommand;
use crate::factory::Factory;
use crate::filter::platform_requirement_filter::IgnoreAllPlatformRequirementFilter;
use crate::filter::platform_requirement_filter::PlatformRequirementFilterFactory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::version::VersionParser;
use crate::package::version::VersionSelector;
@@ -29,6 +17,16 @@ use crate::repository::RepositoryFactory;
use crate::repository::RepositorySet;
use crate::repository::{RepositoryInterface, SearchResult};
use crate::util::Filesystem;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys,
+ array_slice, asort, explode, file_get_contents, implode, in_array, is_array, is_file,
+ is_numeric, json_decode, levenshtein, strlen, strpos, trim,
+};
/// @internal
pub trait PackageDiscoveryTrait: BaseCommand {
diff --git a/crates/shirabe/src/command/prohibits_command.rs b/crates/shirabe/src/command/prohibits_command.rs
index 7c034aa..2423dc7 100644
--- a/crates/shirabe/src/command/prohibits_command.rs
+++ b/crates/shirabe/src/command/prohibits_command.rs
@@ -1,5 +1,10 @@
//! ref: composer/src/Composer/Command/ProhibitsCommand.php
+use crate::command::BaseDependencyCommand;
+use crate::command::base_command::base_command_initialize;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
use anyhow::Result;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
@@ -7,12 +12,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseDependencyCommand;
-use crate::command::base_command::base_command_initialize;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::console::input::InputArgument;
-use crate::console::input::InputOption;
-
#[derive(Debug)]
pub struct ProhibitsCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/reinstall_command.rs b/crates/shirabe/src/command/reinstall_command.rs
index b1d74cc..2cafbc3 100644
--- a/crates/shirabe/src/command/reinstall_command.rs
+++ b/crates/shirabe/src/command/reinstall_command.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Command/ReinstallCommand.php
-use anyhow::Result;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::InvalidArgumentException;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -23,6 +14,14 @@ use crate::plugin::CommandEvent;
use crate::plugin::PluginEvents;
use crate::script::ScriptEvents;
use crate::util::Platform;
+use anyhow::Result;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::InvalidArgumentException;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct ReinstallCommand {
diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs
index f864ebe..7422151 100644
--- a/crates/shirabe/src/command/remove_command.rs
+++ b/crates/shirabe/src/command/remove_command.rs
@@ -1,16 +1,5 @@
//! ref: composer/src/Composer/Command/RemoveCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::exception::InvalidArgumentException;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{PhpMixed, UnexpectedValueException, strtolower};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::Auditor;
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
@@ -25,6 +14,16 @@ use crate::io::IOInterfaceImmutable;
use crate::json::JsonFile;
use crate::package::base_package;
use crate::repository::RepositoryInterface;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::exception::InvalidArgumentException;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{PhpMixed, UnexpectedValueException, strtolower};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RemoveCommand {
diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs
index 19dfb6b..ba0778c 100644
--- a/crates/shirabe/src/command/repository_command.rs
+++ b/crates/shirabe/src/command/repository_command.rs
@@ -1,5 +1,14 @@
//! ref: composer/src/Composer/Command/RepositoryCommand.php
+use crate::command::BaseConfigCommand;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::config::Config;
+use crate::config::ConfigSourceInterface;
+use crate::config::JsonConfigSource;
+use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
+use crate::io::IOInterfaceImmutable;
+use crate::json::JsonFile;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -12,16 +21,6 @@ use shirabe_php_shim::{
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseConfigCommand;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::config::Config;
-use crate::config::ConfigSourceInterface;
-use crate::config::JsonConfigSource;
-use crate::console::input::InputArgument;
-use crate::console::input::InputOption;
-use crate::io::IOInterfaceImmutable;
-use crate::json::JsonFile;
-
#[derive(Debug)]
pub struct RepositoryCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs
index 4f50e71..ebd090a 100644
--- a/crates/shirabe/src/command/require_command.rs
+++ b/crates/shirabe/src/command/require_command.rs
@@ -1,21 +1,5 @@
//! ref: composer/src/Composer/Command/RequireCommand.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_external_packages::seld::signal::SignalHandler;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_fill_keys, array_intersect, array_keys, array_map,
- array_merge, array_unique, empty, file_exists, file_get_contents, file_put_contents, filesize,
- implode, is_writable, strtolower, unlink,
-};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::advisory::Auditor;
use crate::command::PackageDiscoveryTrait;
use crate::command::base_command::base_command_initialize;
@@ -28,6 +12,7 @@ use crate::installer::Installer;
use crate::installer::InstallerEvents;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonFile;
use crate::json::JsonManipulator;
use crate::package::base_package;
@@ -44,6 +29,20 @@ use crate::repository::RepositorySet;
use crate::util::Filesystem;
use crate::util::PackageSorter;
use crate::util::Silencer;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_external_packages::seld::signal::SignalHandler;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, array_fill_keys, array_intersect, array_keys, array_map,
+ array_merge, array_unique, empty, file_exists, file_get_contents, file_put_contents, filesize,
+ implode, is_writable, strtolower, unlink,
+};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RequireCommand {
diff --git a/crates/shirabe/src/command/run_script_command.rs b/crates/shirabe/src/command/run_script_command.rs
index a85bb4e..869d97b 100644
--- a/crates/shirabe/src/command/run_script_command.rs
+++ b/crates/shirabe/src/command/run_script_command.rs
@@ -1,15 +1,5 @@
//! ref: composer/src/Composer/Command/RunScriptCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::PhpMixed;
-use shirabe_php_shim::{InvalidArgumentException, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -20,6 +10,15 @@ use crate::script::Event as ScriptEvent;
use crate::script::ScriptEvents;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::PhpMixed;
+use shirabe_php_shim::{InvalidArgumentException, RuntimeException};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RunScriptCommand {
diff --git a/crates/shirabe/src/command/script_alias_command.rs b/crates/shirabe/src/command/script_alias_command.rs
index 9f55b03..20e2901 100644
--- a/crates/shirabe/src/command/script_alias_command.rs
+++ b/crates/shirabe/src/command/script_alias_command.rs
@@ -1,5 +1,11 @@
//! ref: composer/src/Composer/Command/ScriptAliasCommand.php
+use crate::command::BaseCommand;
+use crate::command::BaseCommandData;
+use crate::command::base_command::base_command_initialize;
+use crate::console::input::InputArgument;
+use crate::console::input::InputOption;
+use crate::util::Platform;
use anyhow::Result;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::command::command::Command;
@@ -9,13 +15,6 @@ use shirabe_php_shim::{InvalidArgumentException, LogicException, PhpMixed, is_st
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BaseCommand;
-use crate::command::BaseCommandData;
-use crate::command::base_command::base_command_initialize;
-use crate::console::input::InputArgument;
-use crate::console::input::InputOption;
-use crate::util::Platform;
-
#[derive(Debug)]
pub struct ScriptAliasCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/search_command.rs b/crates/shirabe/src/command/search_command.rs
index f902eb8..6f3f4ce 100644
--- a/crates/shirabe/src/command/search_command.rs
+++ b/crates/shirabe/src/command/search_command.rs
@@ -1,15 +1,5 @@
//! ref: composer/src/Composer/Command/SearchCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, implode, in_array, preg_quote};
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
use crate::console::input::InputArgument;
@@ -22,6 +12,15 @@ use crate::repository::CompositeRepository;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterfaceHandle;
use crate::repository::repository_interface::{self, RepositoryInterface};
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, implode, in_array, preg_quote};
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct SearchCommand {
diff --git a/crates/shirabe/src/command/self_update_command.rs b/crates/shirabe/src/command/self_update_command.rs
index 5b94058..ca567ce 100644
--- a/crates/shirabe/src/command/self_update_command.rs
+++ b/crates/shirabe/src/command/self_update_command.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Command/SelfUpdateCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -15,6 +7,13 @@ use crate::console::input::InputArgument;
use crate::console::input::InputOption;
use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct SelfUpdateCommand {
diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs
index c52e0bf..6e777a1 100644
--- a/crates/shirabe/src/command/show_command.rs
+++ b/crates/shirabe/src/command/show_command.rs
@@ -1,25 +1,5 @@
//! ref: composer/src/Composer/Command/ShowCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use shirabe_php_shim::{
- DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
- array_search, date, date_format_to_strftime, extension_loaded, in_array, realpath, strtolower,
- version_compare,
-};
-use shirabe_semver::Semver;
-use shirabe_spdx_licenses::SpdxLicenses;
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::command::base_command::base_command_initialize;
use crate::command::{BaseCommand, BaseCommandData};
use crate::composer::PartialComposerHandle;
@@ -52,6 +32,24 @@ use crate::repository::RepositorySet;
use crate::repository::RepositoryUtils;
use crate::repository::RootPackageRepository;
use crate::util::PackageInfo;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use shirabe_php_shim::{
+ DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
+ array_search, date, date_format_to_strftime, extension_loaded, in_array, realpath, strtolower,
+ version_compare,
+};
+use shirabe_semver::Semver;
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_spdx_licenses::SpdxLicenses;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct ShowCommand {
diff --git a/crates/shirabe/src/command/status_command.rs b/crates/shirabe/src/command/status_command.rs
index 74a85b4..bec6868 100644
--- a/crates/shirabe/src/command/status_command.rs
+++ b/crates/shirabe/src/command/status_command.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Command/StatusCommand.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -20,6 +12,13 @@ use crate::plugin::CommandEvent;
use crate::plugin::PluginEvents;
use crate::script::ScriptEvents;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct StatusCommand {
diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs
index e602cc2..cce4829 100644
--- a/crates/shirabe/src/command/update_command.rs
+++ b/crates/shirabe/src/command/update_command.rs
@@ -1,10 +1,28 @@
//! ref: composer/src/Composer/Command/UpdateCommand.php
use crate::advisory::Auditor;
+use crate::command::BumpCommand;
+use crate::command::base_command::base_command_initialize;
+use crate::command::{BaseCommand, BaseCommandData};
+use crate::composer::PartialComposerHandle;
use crate::console::input::InputArgument;
use crate::console::input::InputOption;
+use crate::dependency_resolver::request::UpdateAllowTransitiveDeps;
+use crate::installer::Installer;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
use crate::package::base_package;
+use crate::package::loader::RootPackageLoader;
+use crate::package::version::VersionParser;
+use crate::package::version::VersionSelector;
+use crate::plugin::CommandEvent;
+use crate::plugin::PluginEvents;
+use crate::repository::CanonicalPackagesTrait;
+use crate::repository::CompositeRepository;
+use crate::repository::PlatformRepository;
+use crate::repository::RepositorySet;
+use crate::util::HttpDownloader;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -21,25 +39,6 @@ use shirabe_semver::constraint::MultiConstraint;
use std::cell::RefCell;
use std::rc::Rc;
-use crate::command::BumpCommand;
-use crate::command::base_command::base_command_initialize;
-use crate::command::{BaseCommand, BaseCommandData};
-use crate::composer::PartialComposerHandle;
-use crate::dependency_resolver::request::UpdateAllowTransitiveDeps;
-use crate::installer::Installer;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::package::loader::RootPackageLoader;
-use crate::package::version::VersionParser;
-use crate::package::version::VersionSelector;
-use crate::plugin::CommandEvent;
-use crate::plugin::PluginEvents;
-use crate::repository::CanonicalPackagesTrait;
-use crate::repository::CompositeRepository;
-use crate::repository::PlatformRepository;
-use crate::repository::RepositorySet;
-use crate::util::HttpDownloader;
-
#[derive(Debug)]
pub struct UpdateCommand {
base_command_data: BaseCommandData,
diff --git a/crates/shirabe/src/command/validate_command.rs b/crates/shirabe/src/command/validate_command.rs
index fc9a7df..ab88398 100644
--- a/crates/shirabe/src/command/validate_command.rs
+++ b/crates/shirabe/src/command/validate_command.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/Command/ValidateCommand.php
-use anyhow::Result;
-use shirabe_external_packages::symfony::console::command::command::Command;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::command::BaseCommand;
use crate::command::BaseCommandData;
use crate::command::base_command::base_command_initialize;
@@ -20,6 +13,12 @@ use crate::plugin::CommandEvent;
use crate::plugin::PluginEvents;
use crate::util::ConfigValidator;
use crate::util::Filesystem;
+use anyhow::Result;
+use shirabe_external_packages::symfony::console::command::command::Command;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::output::OutputInterface;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct ValidateCommand {
diff --git a/crates/shirabe/src/composer.rs b/crates/shirabe/src/composer.rs
index d6c41e2..e28fb00 100644
--- a/crates/shirabe/src/composer.rs
+++ b/crates/shirabe/src/composer.rs
@@ -1,8 +1,6 @@
//! ref: composer/src/Composer/Composer.php
//! ref: composer/src/Composer/PartialComposer.php
-use shirabe_external_packages::composer::pcre::Preg;
-
use crate::autoload::AutoloadGeneratorInterface;
use crate::config::Config;
use crate::downloader::DownloadManagerInterface;
@@ -13,6 +11,7 @@ use crate::package::{LockerInterface, RootPackageInterfaceHandle};
use crate::plugin::PluginManager;
use crate::repository::RepositoryManagerInterface;
use crate::util::r#loop::Loop;
+use shirabe_external_packages::composer::pcre::Preg;
// TODO: change this information to Shirabe version.
pub const VERSION: &str = "2.9.7";
diff --git a/crates/shirabe/src/config/json_config_source.rs b/crates/shirabe/src/config/json_config_source.rs
index 1ce51ad..1b09e54 100644
--- a/crates/shirabe/src/config/json_config_source.rs
+++ b/crates/shirabe/src/config/json_config_source.rs
@@ -1,5 +1,10 @@
//! ref: composer/src/Composer/Config/JsonConfigSource.php
+use crate::config::ConfigSourceInterface;
+use crate::json::JsonFile;
+use crate::json::JsonManipulator;
+use crate::json::JsonValidationException;
+use crate::util::Filesystem;
use crate::util::Silencer;
use anyhow::Result;
use indexmap::IndexMap;
@@ -8,12 +13,6 @@ use shirabe_php_shim::{
implode, is_writable,
};
-use crate::config::ConfigSourceInterface;
-use crate::json::JsonFile;
-use crate::json::JsonManipulator;
-use crate::json::JsonValidationException;
-use crate::util::Filesystem;
-
/// JSON Configuration Source
#[derive(Debug)]
pub struct JsonConfigSource {
diff --git a/crates/shirabe/src/console/mod.rs b/crates/shirabe/src/console.rs
index 9289d7e..9289d7e 100644
--- a/crates/shirabe/src/console/mod.rs
+++ b/crates/shirabe/src/console.rs
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs
index 3e197a2..077ea0a 100644
--- a/crates/shirabe/src/console/application.rs
+++ b/crates/shirabe/src/console/application.rs
@@ -1,58 +1,6 @@
//! ref: composer/src/Composer/Console/Application.php
//! ref: composer/vendor/symfony/console/Application.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
-use shirabe_external_packages::seld::json_lint::ParsingException;
-use shirabe_external_packages::symfony::console::application::Application as BaseApplication;
-use shirabe_external_packages::symfony::console::command::Command as SymfonyCommand;
-use shirabe_external_packages::symfony::console::command::help_command::HelpCommand;
-use shirabe_external_packages::symfony::console::command::signalable_command_interface::SignalableCommandInterface;
-use shirabe_external_packages::symfony::console::command_loader::command_loader_interface::CommandLoaderInterface;
-use shirabe_external_packages::symfony::console::completion::completion_input::CompletionInput;
-use shirabe_external_packages::symfony::console::completion::completion_suggestions::CompletionSuggestions;
-use shirabe_external_packages::symfony::console::exception::CommandNotFoundException;
-use shirabe_external_packages::symfony::console::exception::invalid_argument_exception::InvalidArgumentException as ConsoleInvalidArgumentException;
-use shirabe_external_packages::symfony::console::exception::invalid_option_exception::InvalidOptionException;
-use shirabe_external_packages::symfony::console::exception::logic_exception::LogicException as ConsoleLogicException;
-use shirabe_external_packages::symfony::console::exception::missing_input_exception::MissingInputException;
-use shirabe_external_packages::symfony::console::exception::namespace_not_found_exception::NamespaceNotFoundException;
-use shirabe_external_packages::symfony::console::exception::runtime_exception::RuntimeException as ConsoleRuntimeException;
-use shirabe_external_packages::symfony::console::formatter::output_formatter::OutputFormatter;
-use shirabe_external_packages::symfony::console::helper::HelperSet;
-use shirabe_external_packages::symfony::console::helper::QuestionHelper;
-use shirabe_external_packages::symfony::console::helper::formatter_helper::{
- FormatBlockMessages, FormatterHelper,
-};
-use shirabe_external_packages::symfony::console::helper::helper::Helper;
-use shirabe_external_packages::symfony::console::input::InputDefinition;
-use shirabe_external_packages::symfony::console::input::InputInterface;
-use shirabe_external_packages::symfony::console::input::InputOption;
-use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput;
-use shirabe_external_packages::symfony::console::input::array_input::ArrayInput;
-use shirabe_external_packages::symfony::console::input::input_argument::InputArgument;
-use shirabe_external_packages::symfony::console::output::console_output::ConsoleOutput;
-use shirabe_external_packages::symfony::console::output::output_interface::{
- self as output_interface, OutputInterface,
-};
-use shirabe_external_packages::symfony::console::signal_registry::signal_registry::SignalRegistry;
-use shirabe_external_packages::symfony::console::style::style_interface::StyleInterface;
-use shirabe_external_packages::symfony::console::style::symfony_style::SymfonyStyle;
-use shirabe_external_packages::symfony::console::terminal::Terminal;
-use shirabe_external_packages::symfony::process::exception::ProcessTimedOutException;
-use shirabe_php_shim::{
- LogicException as ShimLogicException, PHP_BINARY, PHP_VERSION, PHP_VERSION_ID, PhpMixed,
- RuntimeException, bin2hex, chdir, date_default_timezone_get, date_default_timezone_set,
- defined, dirname, disk_free_space, extension_loaded, file_exists, file_get_contents,
- file_put_contents, function_exists, getcwd, getmypid, glob, in_array, ini_set, is_array,
- is_dir, is_file, is_string, is_subclass_of, json_decode, memory_get_peak_usage,
- memory_get_usage, microtime, php_uname, posix_getuid, random_bytes, realpath,
- restore_error_handler, round, str_contains, str_replace, strpos, strtoupper, sys_get_temp_dir,
- time, unlink,
-};
-
use crate::command::AboutCommand;
use crate::command::ArchiveCommand;
use crate::command::AuditCommand;
@@ -98,12 +46,62 @@ use crate::io::ConsoleIO;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
use crate::io::NullIO;
+use crate::io::io_interface;
use crate::json::JsonValidationException;
use crate::util::ErrorHandler;
use crate::util::Filesystem;
use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::Silencer;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
+use shirabe_external_packages::seld::json_lint::ParsingException;
+use shirabe_external_packages::symfony::console::application::Application as BaseApplication;
+use shirabe_external_packages::symfony::console::command::Command as SymfonyCommand;
+use shirabe_external_packages::symfony::console::command::help_command::HelpCommand;
+use shirabe_external_packages::symfony::console::command::signalable_command_interface::SignalableCommandInterface;
+use shirabe_external_packages::symfony::console::command_loader::command_loader_interface::CommandLoaderInterface;
+use shirabe_external_packages::symfony::console::completion::completion_input::CompletionInput;
+use shirabe_external_packages::symfony::console::completion::completion_suggestions::CompletionSuggestions;
+use shirabe_external_packages::symfony::console::exception::CommandNotFoundException;
+use shirabe_external_packages::symfony::console::exception::invalid_argument_exception::InvalidArgumentException as ConsoleInvalidArgumentException;
+use shirabe_external_packages::symfony::console::exception::invalid_option_exception::InvalidOptionException;
+use shirabe_external_packages::symfony::console::exception::logic_exception::LogicException as ConsoleLogicException;
+use shirabe_external_packages::symfony::console::exception::missing_input_exception::MissingInputException;
+use shirabe_external_packages::symfony::console::exception::namespace_not_found_exception::NamespaceNotFoundException;
+use shirabe_external_packages::symfony::console::exception::runtime_exception::RuntimeException as ConsoleRuntimeException;
+use shirabe_external_packages::symfony::console::formatter::output_formatter::OutputFormatter;
+use shirabe_external_packages::symfony::console::helper::HelperSet;
+use shirabe_external_packages::symfony::console::helper::QuestionHelper;
+use shirabe_external_packages::symfony::console::helper::formatter_helper::{
+ FormatBlockMessages, FormatterHelper,
+};
+use shirabe_external_packages::symfony::console::helper::helper::Helper;
+use shirabe_external_packages::symfony::console::input::InputDefinition;
+use shirabe_external_packages::symfony::console::input::InputInterface;
+use shirabe_external_packages::symfony::console::input::InputOption;
+use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput;
+use shirabe_external_packages::symfony::console::input::array_input::ArrayInput;
+use shirabe_external_packages::symfony::console::input::input_argument::InputArgument;
+use shirabe_external_packages::symfony::console::output::console_output::ConsoleOutput;
+use shirabe_external_packages::symfony::console::output::output_interface::{
+ self, OutputInterface,
+};
+use shirabe_external_packages::symfony::console::signal_registry::signal_registry::SignalRegistry;
+use shirabe_external_packages::symfony::console::style::style_interface::StyleInterface;
+use shirabe_external_packages::symfony::console::style::symfony_style::SymfonyStyle;
+use shirabe_external_packages::symfony::console::terminal::Terminal;
+use shirabe_external_packages::symfony::process::exception::ProcessTimedOutException;
+use shirabe_php_shim::{
+ LogicException as ShimLogicException, PHP_BINARY, PHP_VERSION, PHP_VERSION_ID, PhpMixed,
+ RuntimeException, bin2hex, chdir, date_default_timezone_get, date_default_timezone_set,
+ defined, dirname, disk_free_space, extension_loaded, file_exists, file_get_contents,
+ file_put_contents, function_exists, getcwd, getmypid, glob, in_array, ini_set, is_array,
+ is_dir, is_file, is_string, is_subclass_of, json_decode, memory_get_peak_usage,
+ memory_get_usage, microtime, php_uname, posix_getuid, random_bytes, realpath,
+ restore_error_handler, round, str_contains, str_replace, strpos, strtoupper, sys_get_temp_dir,
+ time, unlink,
+};
/// The PHP `Composer\Console\Application` and `Symfony\Component\Console\Application` are
/// flattened into a single struct. Methods that are overridden by subclass and called via
@@ -867,7 +865,7 @@ impl Application {
merged.extend(ns);
}
let merged: Vec<String> = merged.into_iter().filter(|s| !s.is_empty()).collect();
- let mut seen = std::collections::HashSet::new();
+ let mut seen = indexmap::IndexSet::new();
let unique: Vec<String> = merged
.into_iter()
.filter(|s| seen.insert(s.clone()))
@@ -1044,7 +1042,7 @@ impl Application {
let commands_clone = commands.clone();
let mut new_commands: Vec<String> = Vec::new();
- let mut seen = std::collections::HashSet::new();
+ let mut seen = indexmap::IndexSet::new();
for name_or_alias in commands {
if !command_list.contains_key(&name_or_alias) {
let loaded = self.command_loader.as_ref().unwrap().get(&name_or_alias);
diff --git a/crates/shirabe/src/console/input/mod.rs b/crates/shirabe/src/console/input.rs
index 9141f0c..9141f0c 100644
--- a/crates/shirabe/src/console/input/mod.rs
+++ b/crates/shirabe/src/console/input.rs
diff --git a/crates/shirabe/src/dependency_resolver/mod.rs b/crates/shirabe/src/dependency_resolver.rs
index bcde18b..bcde18b 100644
--- a/crates/shirabe/src/dependency_resolver/mod.rs
+++ b/crates/shirabe/src/dependency_resolver.rs
diff --git a/crates/shirabe/src/dependency_resolver/default_policy.rs b/crates/shirabe/src/dependency_resolver/default_policy.rs
index 5b0981d..d56a96c 100644
--- a/crates/shirabe/src/dependency_resolver/default_policy.rs
+++ b/crates/shirabe/src/dependency_resolver/default_policy.rs
@@ -1,16 +1,14 @@
//! ref: composer/src/Composer/DependencyResolver/DefaultPolicy.php
-use std::cell::RefCell;
-
-use indexmap::IndexMap;
-use shirabe_semver::CompilingMatcher;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::dependency_resolver::PolicyInterface;
use crate::dependency_resolver::Pool;
use crate::package::BasePackageHandle;
use crate::package::STABILITIES;
use crate::util::Platform;
+use indexmap::IndexMap;
+use shirabe_semver::CompilingMatcher;
+use shirabe_semver::constraint::SimpleConstraint;
+use std::cell::RefCell;
#[derive(Debug)]
pub struct DefaultPolicy {
diff --git a/crates/shirabe/src/dependency_resolver/generic_rule.rs b/crates/shirabe/src/dependency_resolver/generic_rule.rs
index 9098e93..afab376 100644
--- a/crates/shirabe/src/dependency_resolver/generic_rule.rs
+++ b/crates/shirabe/src/dependency_resolver/generic_rule.rs
@@ -1,11 +1,10 @@
//! ref: composer/src/Composer/DependencyResolver/GenericRule.php
+use super::rule::ReasonData;
use crate::dependency_resolver::{Rule, RuleBase};
use anyhow::Result;
use shirabe_php_shim::{PHP_VERSION_ID, RuntimeException, hash_raw, unpack};
-use super::rule::ReasonData;
-
#[derive(Debug)]
pub struct GenericRule {
inner: RuleBase,
diff --git a/crates/shirabe/src/dependency_resolver/lock_transaction.rs b/crates/shirabe/src/dependency_resolver/lock_transaction.rs
index 3cabdcd..fb34562 100644
--- a/crates/shirabe/src/dependency_resolver/lock_transaction.rs
+++ b/crates/shirabe/src/dependency_resolver/lock_transaction.rs
@@ -1,12 +1,11 @@
//! ref: composer/src/Composer/DependencyResolver/LockTransaction.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-
use crate::dependency_resolver::Decisions;
use crate::dependency_resolver::Pool;
use crate::dependency_resolver::Transaction;
use crate::package::PackageInterfaceHandle;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
#[derive(Debug)]
pub struct LockTransaction {
diff --git a/crates/shirabe/src/dependency_resolver/operation/mod.rs b/crates/shirabe/src/dependency_resolver/operation.rs
index 720c5a0..720c5a0 100644
--- a/crates/shirabe/src/dependency_resolver/operation/mod.rs
+++ b/crates/shirabe/src/dependency_resolver/operation.rs
diff --git a/crates/shirabe/src/dependency_resolver/pool.rs b/crates/shirabe/src/dependency_resolver/pool.rs
index 43d959b..1b072b4 100644
--- a/crates/shirabe/src/dependency_resolver/pool.rs
+++ b/crates/shirabe/src/dependency_resolver/pool.rs
@@ -1,16 +1,14 @@
//! ref: composer/src/Composer/DependencyResolver/Pool.php
-use std::fmt;
-
+use crate::advisory::AnySecurityAdvisory;
+use crate::package::BasePackageHandle;
+use crate::package::version::VersionParser;
use indexmap::IndexMap;
use shirabe_php_shim::{STR_PAD_LEFT, str_pad};
use shirabe_semver::CompilingMatcher;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-
-use crate::advisory::AnySecurityAdvisory;
-use crate::package::BasePackageHandle;
-use crate::package::version::VersionParser;
+use std::fmt;
/// A package pool contains all packages for dependency resolution
#[derive(Debug)]
diff --git a/crates/shirabe/src/dependency_resolver/pool_builder.rs b/crates/shirabe/src/dependency_resolver/pool_builder.rs
index 986cbdf..5cfaa33 100644
--- a/crates/shirabe/src/dependency_resolver/pool_builder.rs
+++ b/crates/shirabe/src/dependency_resolver/pool_builder.rs
@@ -1,20 +1,5 @@
//! ref: composer/src/Composer/DependencyResolver/PoolBuilder.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- LogicException, PhpMixed, array_flip_strings, array_map, in_array, microtime, number_format,
- round, strpos,
-};
-use shirabe_semver::CompilingMatcher;
-use shirabe_semver::Intervals;
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::MatchAllConstraint;
-use shirabe_semver::constraint::MultiConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::dependency_resolver::Pool;
use crate::dependency_resolver::PoolOptimizer;
use crate::dependency_resolver::Request;
@@ -22,6 +7,7 @@ use crate::dependency_resolver::SecurityAdvisoryPoolFilter;
use crate::event_dispatcher::EventDispatcherInterface;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::AliasPackageHandle;
use crate::package::BasePackageHandle;
use crate::package::CompleteAliasPackageHandle;
@@ -32,6 +18,18 @@ use crate::repository::CanonicalPackagesTrait;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterfaceHandle;
use crate::repository::RootPackageRepository;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ LogicException, PhpMixed, array_flip_strings, array_map, in_array, microtime, number_format,
+ round, strpos,
+};
+use shirabe_semver::CompilingMatcher;
+use shirabe_semver::Intervals;
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::MatchAllConstraint;
+use shirabe_semver::constraint::MultiConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug)]
pub struct PoolBuilder {
diff --git a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
index 3cc5551..6238ddb 100644
--- a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
+++ b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
@@ -1,7 +1,10 @@
//! ref: composer/src/Composer/DependencyResolver/PoolOptimizer.php
-use std::rc::Rc;
-
+use crate::dependency_resolver::PolicyInterface;
+use crate::dependency_resolver::Pool;
+use crate::dependency_resolver::Request;
+use crate::package::BasePackageHandle;
+use crate::package::version::VersionParser;
use indexmap::IndexMap;
use shirabe_php_shim::{implode, ksort};
use shirabe_semver::CompilingMatcher;
@@ -9,12 +12,7 @@ use shirabe_semver::Intervals;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MultiConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-
-use crate::dependency_resolver::PolicyInterface;
-use crate::dependency_resolver::Pool;
-use crate::dependency_resolver::Request;
-use crate::package::BasePackageHandle;
-use crate::package::version::VersionParser;
+use std::rc::Rc;
/// Optimizes a given pool
#[derive(Debug)]
diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs
index 230ebc3..ac05033 100644
--- a/crates/shirabe/src/dependency_resolver/problem.rs
+++ b/crates/shirabe/src/dependency_resolver/problem.rs
@@ -1,7 +1,15 @@
//! ref: composer/src/Composer/DependencyResolver/Problem.php
+use crate::dependency_resolver::Pool;
+use crate::dependency_resolver::Request;
+use crate::dependency_resolver::rule::{self, Rule};
+use crate::package::BasePackageHandle;
+use crate::package::Link;
+use crate::package::version::VersionParser;
+use crate::repository::LockArrayRepository;
+use crate::repository::PlatformRepository;
+use crate::repository::RepositorySet;
use indexmap::IndexMap;
-
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
use shirabe_php_shim::{
@@ -13,16 +21,6 @@ use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MultiConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use crate::dependency_resolver::Pool;
-use crate::dependency_resolver::Request;
-use crate::dependency_resolver::rule::{self, Rule};
-use crate::package::BasePackageHandle;
-use crate::package::Link;
-use crate::package::version::VersionParser;
-use crate::repository::LockArrayRepository;
-use crate::repository::PlatformRepository;
-use crate::repository::RepositorySet;
-
/// Represents a problem detected while solving dependencies
#[derive(Debug)]
pub struct Problem {
diff --git a/crates/shirabe/src/dependency_resolver/request.rs b/crates/shirabe/src/dependency_resolver/request.rs
index d3bcdfc..0a05f3e 100644
--- a/crates/shirabe/src/dependency_resolver/request.rs
+++ b/crates/shirabe/src/dependency_resolver/request.rs
@@ -1,14 +1,13 @@
//! ref: composer/src/Composer/DependencyResolver/Request.php
+use crate::package::BasePackageHandle;
+use crate::repository::LockArrayRepositoryHandle;
+use crate::repository::RepositoryInterface;
use indexmap::IndexMap;
use shirabe_php_shim::{LogicException, strtolower};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MatchAllConstraint;
-use crate::package::BasePackageHandle;
-use crate::repository::LockArrayRepositoryHandle;
-use crate::repository::RepositoryInterface;
-
/// Identifies a partial update for listed packages only, all dependencies will remain at locked versions
pub const UPDATE_ONLY_LISTED: i64 = 0;
diff --git a/crates/shirabe/src/dependency_resolver/rule.rs b/crates/shirabe/src/dependency_resolver/rule.rs
index 306f633..958af5a 100644
--- a/crates/shirabe/src/dependency_resolver/rule.rs
+++ b/crates/shirabe/src/dependency_resolver/rule.rs
@@ -1,16 +1,5 @@
//! ref: composer/src/Composer/DependencyResolver/Rule.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_php_shim::{
- LogicException, PhpMixed, RuntimeException, array_keys, array_shift, implode,
-};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::dependency_resolver::GenericRule;
use crate::dependency_resolver::MultiConflictRule;
use crate::dependency_resolver::Pool;
@@ -23,6 +12,15 @@ use crate::package::version::VersionParser;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterface;
use crate::repository::RepositorySet;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ LogicException, PhpMixed, RuntimeException, array_keys, array_shift, implode,
+};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub enum ReasonData {
diff --git a/crates/shirabe/src/dependency_resolver/rule_set.rs b/crates/shirabe/src/dependency_resolver/rule_set.rs
index d88f346..cde4ebc 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set.rs
@@ -1,16 +1,14 @@
//! ref: composer/src/Composer/DependencyResolver/RuleSet.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use indexmap::IndexMap;
-use shirabe_php_shim::OutOfBoundsException;
-
use crate::dependency_resolver::Pool;
use crate::dependency_resolver::Request;
use crate::dependency_resolver::Rule;
use crate::dependency_resolver::RuleSetIterator;
use crate::repository::RepositorySet;
+use indexmap::IndexMap;
+use shirabe_php_shim::OutOfBoundsException;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RuleSet {
diff --git a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
index 1d9d0c4..6c2824e 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
@@ -1,11 +1,5 @@
//! ref: composer/src/Composer/DependencyResolver/RuleSetGenerator.php
-use std::cell::RefCell;
-use std::collections::VecDeque;
-use std::rc::Rc;
-
-use indexmap::IndexMap;
-
use crate::dependency_resolver::GenericRule;
use crate::dependency_resolver::MultiConflictRule;
use crate::dependency_resolver::PolicyInterface;
@@ -18,6 +12,10 @@ use crate::filter::platform_requirement_filter::IgnoreListPlatformRequirementFil
use crate::filter::platform_requirement_filter::PlatformRequirementFilterFactory;
use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface;
use crate::package::PackageInterfaceHandle;
+use indexmap::IndexMap;
+use std::cell::RefCell;
+use std::collections::VecDeque;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RuleSetGenerator {
diff --git a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
index 91cfff2..2c4b9a4 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/DependencyResolver/RuleSetIterator.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::dependency_resolver::Rule;
use indexmap::IndexMap;
+use std::cell::RefCell;
+use std::rc::Rc;
/// Implements PHP \Iterator over a grouped rule set.
#[derive(Debug)]
diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
index 370d553..b746f50 100644
--- a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
@@ -1,14 +1,12 @@
//! ref: composer/src/Composer/DependencyResolver/RuleWatchGraph.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use indexmap::IndexMap;
-
use crate::dependency_resolver::Decisions;
use crate::dependency_resolver::Rule;
use crate::dependency_resolver::RuleWatchChain;
use crate::dependency_resolver::RuleWatchNode;
+use indexmap::IndexMap;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct RuleWatchGraph {
diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
index 7292ae0..92faae7 100644
--- a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/DependencyResolver/RuleWatchNode.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::dependency_resolver::Decisions;
use crate::dependency_resolver::Rule;
+use std::cell::RefCell;
+use std::rc::Rc;
pub struct RuleWatchNode {
pub watch1: i64,
diff --git a/crates/shirabe/src/dependency_resolver/solver.rs b/crates/shirabe/src/dependency_resolver/solver.rs
index 53a26ac..933f79f 100644
--- a/crates/shirabe/src/dependency_resolver/solver.rs
+++ b/crates/shirabe/src/dependency_resolver/solver.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/DependencyResolver/Solver.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use indexmap::IndexMap;
-
-use shirabe_php_shim::{array_shift, array_unshift, microtime, spl_object_hash};
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::dependency_resolver::Decisions;
use crate::dependency_resolver::GenericRule;
use crate::dependency_resolver::LockTransaction;
@@ -28,6 +20,11 @@ use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterfa
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
use crate::package::BasePackageHandle;
+use indexmap::IndexMap;
+use shirabe_php_shim::{array_shift, array_unshift, microtime, spl_object_hash};
+use shirabe_semver::constraint::AnyConstraint;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct Solver {
diff --git a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
index d5f5560..b0016d0 100644
--- a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
+++ b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
@@ -1,16 +1,14 @@
//! ref: composer/src/Composer/DependencyResolver/SolverProblemsException.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use shirabe_php_shim::RuntimeException;
-
use crate::dependency_resolver::Pool;
use crate::dependency_resolver::Problem;
use crate::dependency_resolver::Request;
use crate::dependency_resolver::Rule;
use crate::repository::RepositorySet;
use crate::util::IniHelper;
+use shirabe_php_shim::RuntimeException;
+use std::cell::RefCell;
+use std::rc::Rc;
#[derive(Debug)]
pub struct SolverProblemsException {
diff --git a/crates/shirabe/src/dependency_resolver/transaction.rs b/crates/shirabe/src/dependency_resolver/transaction.rs
index 9e0a709..07564ed 100644
--- a/crates/shirabe/src/dependency_resolver/transaction.rs
+++ b/crates/shirabe/src/dependency_resolver/transaction.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/DependencyResolver/Transaction.php
-use indexmap::IndexMap;
-use indexmap::IndexSet;
-use shirabe_php_shim::{
- PhpMixed, array_filter, array_intersect, array_keys, array_pop, array_unshift, strcmp, uasort,
- uasort_map,
-};
-
use crate::dependency_resolver::operation::InstallOperation;
use crate::dependency_resolver::operation::MarkAliasInstalledOperation;
use crate::dependency_resolver::operation::MarkAliasUninstalledOperation;
@@ -17,6 +10,12 @@ use crate::package::AliasPackageHandle;
use crate::package::Link;
use crate::package::PackageInterfaceHandle;
use crate::repository::PlatformRepository;
+use indexmap::IndexMap;
+use indexmap::IndexSet;
+use shirabe_php_shim::{
+ PhpMixed, array_filter, array_intersect, array_keys, array_pop, array_unshift, strcmp, uasort,
+ uasort_map,
+};
/// @internal
#[derive(Debug, Clone)]
diff --git a/crates/shirabe/src/downloader/mod.rs b/crates/shirabe/src/downloader.rs
index 4f7641b..4f7641b 100644
--- a/crates/shirabe/src/downloader/mod.rs
+++ b/crates/shirabe/src/downloader.rs
diff --git a/crates/shirabe/src/downloader/archive_downloader.rs b/crates/shirabe/src/downloader/archive_downloader.rs
index b1bdee7..4744bc2 100644
--- a/crates/shirabe/src/downloader/archive_downloader.rs
+++ b/crates/shirabe/src/downloader/archive_downloader.rs
@@ -1,5 +1,12 @@
//! ref: composer/src/Composer/Downloader/ArchiveDownloader.php
+use crate::dependency_resolver::operation::InstallOperation;
+use crate::downloader::DownloaderInterface;
+use crate::downloader::FileDownloader;
+use crate::io::IOInterfaceImmutable;
+use crate::package::PackageInterfaceHandle;
+use crate::util::Filesystem;
+use crate::util::Platform;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::finder::Finder;
@@ -9,14 +16,6 @@ use shirabe_php_shim::{
};
use std::path::{Path, PathBuf};
-use crate::dependency_resolver::operation::InstallOperation;
-use crate::downloader::DownloaderInterface;
-use crate::downloader::FileDownloader;
-use crate::io::IOInterfaceImmutable;
-use crate::package::PackageInterfaceHandle;
-use crate::util::Filesystem;
-use crate::util::Platform;
-
pub trait ArchiveDownloader {
fn inner(&self) -> &FileDownloader;
fn inner_mut(&mut self) -> &mut FileDownloader;
diff --git a/crates/shirabe/src/downloader/change_report_interface.rs b/crates/shirabe/src/downloader/change_report_interface.rs
index 718b2c1..ca2a113 100644
--- a/crates/shirabe/src/downloader/change_report_interface.rs
+++ b/crates/shirabe/src/downloader/change_report_interface.rs
@@ -1,8 +1,7 @@
//! ref: composer/src/Composer/Downloader/ChangeReportInterface.php
-use anyhow::Result;
-
use crate::package::PackageInterfaceHandle;
+use anyhow::Result;
pub trait ChangeReportInterface {
fn get_local_changes(
diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs
index b978368..82bf4bb 100644
--- a/crates/shirabe/src/downloader/download_manager.rs
+++ b/crates/shirabe/src/downloader/download_manager.rs
@@ -1,6 +1,12 @@
//! ref: composer/src/Composer/Downloader/DownloadManager.php
+use crate::downloader::DownloaderInterface;
+use crate::exception::IrrecoverableDownloadException;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::package::PackageInterfaceHandle;
+use crate::util::Filesystem;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -10,13 +16,6 @@ use shirabe_php_shim::{
strtolower, usort,
};
-use crate::downloader::DownloaderInterface;
-use crate::exception::IrrecoverableDownloadException;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::package::PackageInterfaceHandle;
-use crate::util::Filesystem;
-
/// Downloaders manager.
#[derive(Debug)]
pub struct DownloadManager {
diff --git a/crates/shirabe/src/downloader/dvcs_downloader_interface.rs b/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
index 59f5774..e33aa46 100644
--- a/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
+++ b/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
@@ -1,8 +1,7 @@
//! ref: composer/src/Composer/Downloader/DvcsDownloaderInterface.php
-use anyhow::Result;
-
use crate::package::PackageInterfaceHandle;
+use anyhow::Result;
pub trait DvcsDownloaderInterface {
fn get_unpushed_changes(
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index 66f3390..d3e1f6c 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -1,18 +1,5 @@
//! ref: composer/src/Composer/Downloader/FileDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use std::sync::{LazyLock, Mutex};
-
-use crate::util::Silencer;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION,
- PHP_URL_PATH, PhpMixed, RuntimeException, UnexpectedValueException, array_search, file_exists,
- filesize, get_class, hash, hash_file, in_array, is_dir, is_executable, parse_url, pathinfo,
- realpath, rtrim, spl_object_hash, strlen, strpos, strtr, trim, umask, usleep,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
@@ -27,13 +14,24 @@ use crate::exception::IrrecoverableDownloadException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
use crate::io::NullIO;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::comparer::Comparer;
use crate::util::Filesystem;
use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use crate::util::Url as UrlUtil;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION,
+ PHP_URL_PATH, PhpMixed, RuntimeException, UnexpectedValueException, array_search, file_exists,
+ filesize, get_class, hash, hash_file, in_array, is_dir, is_executable, parse_url, pathinfo,
+ realpath, rtrim, spl_object_hash, strlen, strpos, strtr, trim, umask, usleep,
+};
+use std::sync::{LazyLock, Mutex};
/// @var array<string, int|string>
/// @private
diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs
index fd044f8..dc27e0c 100644
--- a/crates/shirabe/src/downloader/git_downloader.rs
+++ b/crates/shirabe/src/downloader/git_downloader.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Downloader/GitDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_map, basename, dirname, implode, in_array, is_dir,
- preg_quote, realpath, rtrim, strlen, strpos, substr, trim, version_compare,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::ChangeReportInterface;
@@ -18,12 +9,20 @@ use crate::downloader::VcsDownloader;
use crate::downloader::VcsDownloaderBase;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::util::Filesystem;
use crate::util::Git as GitUtil;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, array_map, basename, dirname, implode, in_array, is_dir,
+ preg_quote, realpath, rtrim, strlen, strpos, substr, trim, version_compare,
+};
#[derive(Debug)]
pub struct GitDownloader {
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 694f758..cfd4889 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Downloader/PathDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::filesystem::Filesystem as SymfonyFilesystem;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed,
- RuntimeException, file_exists, function_exists, is_dir, realpath,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
@@ -19,6 +10,7 @@ use crate::downloader::VcsCapableDownloaderInterface;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::archiver::ArchivableFilesFinder;
use crate::package::dumper::ArrayDumper;
@@ -28,6 +20,13 @@ use crate::util::Filesystem;
use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::filesystem::Filesystem as SymfonyFilesystem;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed,
+ RuntimeException, file_exists, function_exists, is_dir, realpath,
+};
#[derive(Debug)]
pub struct PathDownloader {
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 8c13a05..cd48dae 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -1,10 +1,5 @@
//! ref: composer/src/Composer/Downloader/SvnDownloader.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{PhpMixed, RuntimeException, is_dir, version_compare};
-
use crate::config::Config;
use crate::downloader::ChangeReportInterface;
use crate::downloader::DownloaderInterface;
@@ -13,11 +8,15 @@ use crate::downloader::VcsDownloader;
use crate::downloader::VcsDownloaderBase;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::repository::VcsRepository;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{PhpMixed, RuntimeException, is_dir, version_compare};
#[derive(Debug)]
pub struct SvnDownloader {
diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs
index 8084c37..1c89571 100644
--- a/crates/shirabe/src/downloader/vcs_downloader.rs
+++ b/crates/shirabe/src/downloader/vcs_downloader.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Downloader/VcsDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, RuntimeException, array_map, array_shift, explode,
- get_class_err, implode, rawurldecode, realpath, str_replace, strlen, strpos, substr, trim,
-};
-
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
use crate::dependency_resolver::operation::UninstallOperation;
@@ -17,12 +9,19 @@ use crate::downloader::DownloaderInterface;
use crate::downloader::VcsCapableDownloaderInterface;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::dumper::ArrayDumper;
use crate::package::version::VersionGuesser;
use crate::package::version::VersionParser;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, RuntimeException, array_map, array_shift, explode,
+ get_class_err, implode, rawurldecode, realpath, str_replace, strlen, strpos, substr, trim,
+};
#[derive(Debug)]
pub struct VcsDownloaderBase {
diff --git a/crates/shirabe/src/event_dispatcher/mod.rs b/crates/shirabe/src/event_dispatcher.rs
index a50fa4d..a50fa4d 100644
--- a/crates/shirabe/src/event_dispatcher/mod.rs
+++ b/crates/shirabe/src/event_dispatcher.rs
diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs
index 091160e..87552a9 100644
--- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs
+++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs
@@ -1,19 +1,5 @@
//! ref: composer/src/Composer/EventDispatcher/EventDispatcher.php
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::symfony::process::ExecutableFinder;
-use shirabe_external_packages::symfony::process::PhpExecutableFinder;
-use shirabe_php_shim::{
- InvalidArgumentException, PATH_SEPARATOR, PhpMixed, RuntimeException, array_pop, array_push,
- array_search_in_vec, array_splice, class_exists, defined, file_exists, get_class, hash,
- implode, ini_get, is_a, is_array, is_callable, is_object, is_string, krsort, preg_quote,
- realpath, spl_autoload_functions, spl_autoload_register, spl_autoload_unregister,
- spl_object_hash, str_contains, str_ends_with, str_replace, str_starts_with, strlen, strpos,
- strtoupper, substr, trim,
-};
-
use crate::autoload::ClassLoader;
use crate::composer::PartialComposerHandle;
use crate::composer::PartialComposerWeakHandle;
@@ -32,6 +18,18 @@ use crate::repository::RepositoryInterface;
use crate::script::Event as ScriptEvent;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::symfony::process::ExecutableFinder;
+use shirabe_external_packages::symfony::process::PhpExecutableFinder;
+use shirabe_php_shim::{
+ InvalidArgumentException, PATH_SEPARATOR, PhpMixed, RuntimeException, array_pop, array_push,
+ array_search_in_vec, array_splice, class_exists, defined, file_exists, get_class, hash,
+ implode, ini_get, is_a, is_array, is_callable, is_object, is_string, krsort, preg_quote,
+ realpath, spl_autoload_functions, spl_autoload_register, spl_autoload_unregister,
+ spl_object_hash, str_contains, str_ends_with, str_replace, str_starts_with, strlen, strpos,
+ strtoupper, substr, trim,
+};
/// Represents a callable listener. PHP's `callable` may be a string (command, script, or
/// "Class::method"), a `[object|string, method]` pair, or a `\Closure`.
@@ -858,7 +856,7 @@ impl EventDispatcher {
) -> anyhow::Result<PhpMixed> {
if self.io.is_verbose() {
self.io.write_error3(
- &format!("> {}: {}::{}", event.get_name(), class_name, method_name,),
+ &format!("> {}: {}::{}", event.get_name(), class_name, method_name),
true,
crate::io::NORMAL,
);
@@ -1218,8 +1216,6 @@ impl EventDispatcher {
Ok(())
}
- // ---- helpers ----
-
fn io_clone(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
self.io.clone()
}
diff --git a/crates/shirabe/src/exception/mod.rs b/crates/shirabe/src/exception.rs
index 0355e35..0355e35 100644
--- a/crates/shirabe/src/exception/mod.rs
+++ b/crates/shirabe/src/exception.rs
diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs
index 6d1729b..b3d478c 100644
--- a/crates/shirabe/src/factory.rs
+++ b/crates/shirabe/src/factory.rs
@@ -1,18 +1,5 @@
//! ref: composer/src/Composer/Factory.php
-use indexmap::IndexMap;
-
-use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
-use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyleInterface;
-use shirabe_external_packages::symfony::console::output::ConsoleOutput;
-use shirabe_php_shim::{
- InvalidArgumentException, PATHINFO_EXTENSION, PHP_EOL, PHP_OS, PhpMixed, RuntimeException,
- UnexpectedValueException, array_replace_recursive, class_exists, dirname, extension_loaded,
- file_exists, file_get_contents, file_put_contents, implode, is_dir, is_file, json_decode,
- mkdir, pathinfo, realpath, rename, rtrim, strpos, strtr, substr, trim,
-};
-
use crate::autoload::AutoloadGenerator;
use crate::cache::Cache;
use crate::composer::{ComposerHandle, ComposerWeakHandle, PartialOrFullComposer};
@@ -64,6 +51,17 @@ use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Silencer;
use crate::util::r#loop::Loop;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle;
+use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyleInterface;
+use shirabe_external_packages::symfony::console::output::ConsoleOutput;
+use shirabe_php_shim::{
+ InvalidArgumentException, PATHINFO_EXTENSION, PHP_EOL, PHP_OS, PhpMixed, RuntimeException,
+ UnexpectedValueException, array_replace_recursive, class_exists, dirname, extension_loaded,
+ file_exists, file_get_contents, file_put_contents, implode, is_dir, is_file, json_decode,
+ mkdir, pathinfo, realpath, rename, rtrim, strpos, strtr, substr, trim,
+};
/// Either a configuration array or a filename to read from. PHP's `$localConfig` accepts both.
pub enum LocalConfigInput {
diff --git a/crates/shirabe/src/filter/mod.rs b/crates/shirabe/src/filter.rs
index a5f35c5..a5f35c5 100644
--- a/crates/shirabe/src/filter/mod.rs
+++ b/crates/shirabe/src/filter.rs
diff --git a/crates/shirabe/src/filter/platform_requirement_filter/mod.rs b/crates/shirabe/src/filter/platform_requirement_filter.rs
index 0a6556f..0a6556f 100644
--- a/crates/shirabe/src/filter/platform_requirement_filter/mod.rs
+++ b/crates/shirabe/src/filter/platform_requirement_filter.rs
diff --git a/crates/shirabe/src/filter/platform_requirement_filter/ignore_list_platform_requirement_filter.rs b/crates/shirabe/src/filter/platform_requirement_filter/ignore_list_platform_requirement_filter.rs
index 854a4f6..709fdfc 100644
--- a/crates/shirabe/src/filter/platform_requirement_filter/ignore_list_platform_requirement_filter.rs
+++ b/crates/shirabe/src/filter/platform_requirement_filter/ignore_list_platform_requirement_filter.rs
@@ -1,5 +1,8 @@
//! ref: composer/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php
+use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface;
+use crate::package::base_package::{self};
+use crate::repository::PlatformRepository;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_semver::Interval;
use shirabe_semver::Intervals;
@@ -8,10 +11,6 @@ use shirabe_semver::constraint::MatchAllConstraint;
use shirabe_semver::constraint::MultiConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface;
-use crate::package::base_package::{self};
-use crate::repository::PlatformRepository;
-
#[derive(Debug)]
pub struct IgnoreListPlatformRequirementFilter {
ignore_regex: String,
diff --git a/crates/shirabe/src/installed_versions.rs b/crates/shirabe/src/installed_versions.rs
index 0e22e06..8b287f1 100644
--- a/crates/shirabe/src/installed_versions.rs
+++ b/crates/shirabe/src/installed_versions.rs
@@ -1,7 +1,6 @@
//! ref: composer/src/Composer/InstalledVersions.php
-use std::sync::Mutex;
-
+use crate::autoload::ClassLoader;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_php_shim::{
@@ -9,8 +8,7 @@ use shirabe_php_shim::{
implode, is_file, method_exists, php_dir, require_php_file, strtr_array, substr,
};
use shirabe_semver::VersionParser;
-
-use crate::autoload::ClassLoader;
+use std::sync::Mutex;
/// This class is copied in every Composer installed project and available to all
///
diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs
index ea73f6f..31e2e7b 100644
--- a/crates/shirabe/src/installer/binary_installer.rs
+++ b/crates/shirabe/src/installer/binary_installer.rs
@@ -1,6 +1,13 @@
//! ref: composer/src/Composer/Installer/BinaryInstaller.php
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::package::PackageInterfaceHandle;
+use crate::util::Filesystem;
+use crate::util::Platform;
+use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
@@ -9,14 +16,6 @@ use shirabe_php_shim::{
substr, trim, umask,
};
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::package::PackageInterfaceHandle;
-use crate::util::Filesystem;
-use crate::util::Platform;
-use crate::util::ProcessExecutor;
-use crate::util::Silencer;
-
/// Seam over the BinaryInstaller methods reached through LibraryInstaller, so tests can inject a
/// recording double. Composer has no PHP `BinaryInstallerInterface`; this exists only to allow the
/// `LibraryInstaller` collaborator to be mocked the way PHPUnit mocks the concrete class.
diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs
index bee14cc..3ce8076 100644
--- a/crates/shirabe/src/installer/installation_manager.rs
+++ b/crates/shirabe/src/installer/installation_manager.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Installer/InstallationManager.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::seld::signal::SignalHandler;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, array_splice, array_unshift, http_build_query, json_encode,
- str_contains, str_replace, strpos, strtolower,
-};
-
use crate::dependency_resolver::operation::InstallOperation;
use crate::dependency_resolver::operation::MarkAliasInstalledOperation;
use crate::dependency_resolver::operation::MarkAliasUninstalledOperation;
@@ -21,10 +12,18 @@ use crate::installer::InstallerInterface;
use crate::installer::PackageEvents;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Platform;
use crate::util::r#loop::Loop;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::seld::signal::SignalHandler;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, array_splice, array_unshift, http_build_query, json_encode,
+ str_contains, str_replace, strpos, strtolower,
+};
/// Package operation manager.
#[derive(Debug)]
diff --git a/crates/shirabe/src/installer/installer_event.rs b/crates/shirabe/src/installer/installer_event.rs
index ca0be22..5171b6d 100644
--- a/crates/shirabe/src/installer/installer_event.rs
+++ b/crates/shirabe/src/installer/installer_event.rs
@@ -1,13 +1,12 @@
//! ref: composer/src/Composer/Installer/InstallerEvent.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::composer::ComposerWeakHandle;
use crate::dependency_resolver::Transaction;
use crate::event_dispatcher::Event;
use crate::event_dispatcher::EventInterface;
use crate::io::IOInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug)]
pub struct InstallerEvent {
diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs
index 26fbf0e..133ba7c 100644
--- a/crates/shirabe/src/installer/library_installer.rs
+++ b/crates/shirabe/src/installer/library_installer.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/Installer/LibraryInstaller.php
-use anyhow::Result;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, dirname, is_dir, is_link, preg_quote,
- realpath, rmdir, rtrim, strpos,
-};
-
use crate::composer::PartialComposerWeakHandle;
use crate::downloader::DownloadManagerInterface;
use crate::installer::BinaryInstaller;
@@ -19,6 +12,12 @@ use crate::repository::InstalledRepositoryInterface;
use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::Silencer;
+use anyhow::Result;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PhpMixed, dirname, is_dir, is_link, preg_quote,
+ realpath, rmdir, rtrim, strpos,
+};
/// Package installation manager.
#[derive(Debug)]
diff --git a/crates/shirabe/src/io/mod.rs b/crates/shirabe/src/io.rs
index f7c8ad1..f7c8ad1 100644
--- a/crates/shirabe/src/io/mod.rs
+++ b/crates/shirabe/src/io.rs
diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs
index d14d730..210dbdc 100644
--- a/crates/shirabe/src/io/console_io.rs
+++ b/crates/shirabe/src/io/console_io.rs
@@ -1,7 +1,13 @@
//! ref: composer/src/Composer/IO/ConsoleIO.php
use crate::config::Config;
+use crate::io::BaseIO;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
+use crate::io::IOInterfaceMutable;
use crate::io::io_interface;
+use crate::question::StrictConfirmationQuestion;
+use crate::util::Silencer;
use indexmap::IndexMap;
use indexmap::indexmap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -12,7 +18,7 @@ use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::ConsoleOutput;
use shirabe_external_packages::symfony::console::output::ConsoleOutputInterface;
use shirabe_external_packages::symfony::console::output::output_interface::{
- self as output_interface, OutputInterface,
+ self, OutputInterface,
};
use shirabe_external_packages::symfony::console::question::ChoiceQuestion;
use shirabe_external_packages::symfony::console::question::Question;
@@ -23,13 +29,6 @@ use shirabe_php_shim::{
};
use std::cell::RefCell;
-use crate::io::BaseIO;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::io::IOInterfaceMutable;
-use crate::question::StrictConfirmationQuestion;
-use crate::util::Silencer;
-
/// The Input/Output helper.
#[derive(Debug)]
pub struct ConsoleIO {
diff --git a/crates/shirabe/src/json/mod.rs b/crates/shirabe/src/json.rs
index e5c3406..e5c3406 100644
--- a/crates/shirabe/src/json/mod.rs
+++ b/crates/shirabe/src/json.rs
diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs
index b38de1e..c0b8816 100644
--- a/crates/shirabe/src/json/json_file.rs
+++ b/crates/shirabe/src/json/json_file.rs
@@ -1,6 +1,12 @@
//! ref: composer/src/Composer/Json/JsonFile.php
+use crate::downloader::TransportException;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::json::JsonValidationException;
+use crate::util::Filesystem;
+use crate::util::HttpDownloader;
use crate::util::Silencer;
use anyhow::Result;
use indexmap::IndexMap;
@@ -14,13 +20,6 @@ use shirabe_php_shim::{
str_ends_with, str_repeat, strlen, strpos, usleep,
};
-use crate::downloader::TransportException;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::json::JsonValidationException;
-use crate::util::Filesystem;
-use crate::util::HttpDownloader;
-
#[derive(Debug, Clone)]
pub struct JsonEncodeOptions {
pub unescaped_slashes: bool,
diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs
index c62e31e..043534d 100644
--- a/crates/shirabe/src/json/json_manipulator.rs
+++ b/crates/shirabe/src/json/json_manipulator.rs
@@ -1,7 +1,9 @@
//! ref: composer/src/Composer/Json/JsonManipulator.php
+use crate::json::JsonFile;
+use crate::json::json_grammar::{self, ValueKind};
+use crate::repository::PlatformRepository;
use indexmap::IndexMap;
-
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, addcslashes, array_key_exists, array_keys,
@@ -10,10 +12,6 @@ use shirabe_php_shim::{
trim, uksort,
};
-use crate::json::JsonFile;
-use crate::json::json_grammar::{self, ValueKind};
-use crate::repository::PlatformRepository;
-
#[derive(Debug)]
pub struct JsonManipulator {
contents: String,
diff --git a/crates/shirabe/src/package/mod.rs b/crates/shirabe/src/package.rs
index 912ac17..912ac17 100644
--- a/crates/shirabe/src/package/mod.rs
+++ b/crates/shirabe/src/package.rs
diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs
index 5af61b2..79204df 100644
--- a/crates/shirabe/src/package/alias_package.rs
+++ b/crates/shirabe/src/package/alias_package.rs
@@ -1,10 +1,5 @@
//! ref: composer/src/Composer/Package/AliasPackage.php
-use chrono::{DateTime, Utc};
-use indexmap::IndexMap;
-use shirabe_php_shim::{PhpMixed, in_array};
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::package::BasePackage;
use crate::package::Link;
use crate::package::Mirror;
@@ -12,6 +7,10 @@ use crate::package::PackageHandle;
use crate::package::PackageInterface;
use crate::package::version::VersionParser;
use crate::repository::RepositoryInterfaceHandle;
+use chrono::{DateTime, Utc};
+use indexmap::IndexMap;
+use shirabe_php_shim::{PhpMixed, in_array};
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug, Clone)]
pub struct AliasPackage {
diff --git a/crates/shirabe/src/package/archiver/mod.rs b/crates/shirabe/src/package/archiver.rs
index b4df5b0..b4df5b0 100644
--- a/crates/shirabe/src/package/archiver/mod.rs
+++ b/crates/shirabe/src/package/archiver.rs
diff --git a/crates/shirabe/src/package/archiver/archive_manager.rs b/crates/shirabe/src/package/archiver/archive_manager.rs
index be911d6..eaeab9c 100644
--- a/crates/shirabe/src/package/archiver/archive_manager.rs
+++ b/crates/shirabe/src/package/archiver/archive_manager.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/Package/Archiver/ArchiveManager.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- InvalidArgumentException, RuntimeException, bin2hex, file_exists, random_bytes, realpath,
- sys_get_temp_dir,
-};
-
use crate::downloader::DownloadManager;
use crate::json::JsonFile;
use crate::package::CompletePackageInterfaceHandle;
@@ -16,6 +9,12 @@ use crate::package::archiver::ZipArchiver;
use crate::util::Filesystem;
use crate::util::SyncHelper;
use crate::util::r#loop::Loop;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ InvalidArgumentException, RuntimeException, bin2hex, file_exists, random_bytes, realpath,
+ sys_get_temp_dir,
+};
pub struct ArchiveManager {
pub(crate) download_manager: std::rc::Rc<std::cell::RefCell<DownloadManager>>,
diff --git a/crates/shirabe/src/package/archiver/phar_archiver.rs b/crates/shirabe/src/package/archiver/phar_archiver.rs
index c25b90b..1bac060 100644
--- a/crates/shirabe/src/package/archiver/phar_archiver.rs
+++ b/crates/shirabe/src/package/archiver/phar_archiver.rs
@@ -1,15 +1,14 @@
//! ref: composer/src/Composer/Package/Archiver/PharArchiver.php
+use crate::package::archiver::ArchivableFilesFilter;
+use crate::package::archiver::ArchivableFilesFinder;
+use crate::package::archiver::ArchiverInterface;
use indexmap::IndexMap;
use shirabe_php_shim::{
FilesystemIterator, Phar, PharData, PhpMixed, RuntimeException, bzcompress, file_exists,
file_put_contents, function_exists, gzcompress, pack, str_repeat, strrpos, unlink,
};
-use crate::package::archiver::ArchivableFilesFilter;
-use crate::package::archiver::ArchivableFilesFinder;
-use crate::package::archiver::ArchiverInterface;
-
fn formats() -> IndexMap<&'static str, i64> {
let mut m = IndexMap::new();
m.insert("zip", Phar::ZIP);
diff --git a/crates/shirabe/src/package/base_package.rs b/crates/shirabe/src/package/base_package.rs
index 60211d2..04b4ea0 100644
--- a/crates/shirabe/src/package/base_package.rs
+++ b/crates/shirabe/src/package/base_package.rs
@@ -1,15 +1,13 @@
//! ref: composer/src/Composer/Package/BasePackage.php
-use std::sync::LazyLock;
-
-use indexmap::IndexMap;
-use shirabe_php_shim::preg_quote;
-
use crate::package::DisplayMode;
use crate::package::Link;
use crate::package::PackageInterface;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterfaceHandle;
+use indexmap::IndexMap;
+use shirabe_php_shim::preg_quote;
+use std::sync::LazyLock;
pub struct SupportedLinkType {
pub description: &'static str,
diff --git a/crates/shirabe/src/package/comparer/mod.rs b/crates/shirabe/src/package/comparer.rs
index 878d7e0..878d7e0 100644
--- a/crates/shirabe/src/package/comparer/mod.rs
+++ b/crates/shirabe/src/package/comparer.rs
diff --git a/crates/shirabe/src/package/comparer/comparer.rs b/crates/shirabe/src/package/comparer/comparer.rs
index 3139295..b0e01bd 100644
--- a/crates/shirabe/src/package/comparer/comparer.rs
+++ b/crates/shirabe/src/package/comparer/comparer.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Package/Comparer/Comparer.php
+use crate::util::Platform;
use indexmap::IndexMap;
use std::path::Path;
-use crate::util::Platform;
-
#[derive(Debug)]
pub struct Comparer {
source: String,
diff --git a/crates/shirabe/src/package/complete_alias_package.rs b/crates/shirabe/src/package/complete_alias_package.rs
index 2fff592..2172157 100644
--- a/crates/shirabe/src/package/complete_alias_package.rs
+++ b/crates/shirabe/src/package/complete_alias_package.rs
@@ -1,13 +1,12 @@
//! ref: composer/src/Composer/Package/CompleteAliasPackage.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::package::AliasPackage;
use crate::package::CompletePackageHandle;
use crate::package::CompletePackageInterface;
use crate::package::PackageHandle;
use crate::package::handle::delegate_package_interface_to_inner;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug, Clone)]
pub struct CompleteAliasPackage {
diff --git a/crates/shirabe/src/package/complete_package_interface.rs b/crates/shirabe/src/package/complete_package_interface.rs
index 42b35ef..948c5e6 100644
--- a/crates/shirabe/src/package/complete_package_interface.rs
+++ b/crates/shirabe/src/package/complete_package_interface.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Package/CompletePackageInterface.php
+use crate::package::PackageInterface;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use crate::package::PackageInterface;
-
pub trait CompletePackageInterface: PackageInterface {
fn get_scripts(&self) -> IndexMap<String, Vec<String>>;
diff --git a/crates/shirabe/src/package/dumper/mod.rs b/crates/shirabe/src/package/dumper.rs
index c501aec..c501aec 100644
--- a/crates/shirabe/src/package/dumper/mod.rs
+++ b/crates/shirabe/src/package/dumper.rs
diff --git a/crates/shirabe/src/package/dumper/array_dumper.rs b/crates/shirabe/src/package/dumper/array_dumper.rs
index ec33340..6688ad5 100644
--- a/crates/shirabe/src/package/dumper/array_dumper.rs
+++ b/crates/shirabe/src/package/dumper/array_dumper.rs
@@ -1,11 +1,10 @@
//! ref: composer/src/Composer/Package/Dumper/ArrayDumper.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{DATE_RFC3339, PhpMixed};
-
use crate::package::Mirror;
use crate::package::PackageInterfaceHandle;
use crate::package::SUPPORTED_LINK_TYPES;
+use indexmap::IndexMap;
+use shirabe_php_shim::{DATE_RFC3339, PhpMixed};
/// Serializes a Mirror back into the PHP array shape `{url, preferred}`.
fn mirror_to_php(mirror: Mirror) -> PhpMixed {
diff --git a/crates/shirabe/src/package/handle.rs b/crates/shirabe/src/package/handle.rs
index 39121fa..28b1dbe 100644
--- a/crates/shirabe/src/package/handle.rs
+++ b/crates/shirabe/src/package/handle.rs
@@ -3,13 +3,12 @@
//! No weak handles are provided: an alias package never aliases another alias package, so the
//! `alias_of` references are acyclic.
-use std::cell::RefCell;
-use std::rc::Rc;
-
use crate::package::{
AliasPackage, CompleteAliasPackage, CompletePackage, CompletePackageInterface, Package,
PackageInterface, RootAliasPackage, RootPackage, RootPackageInterface,
};
+use std::cell::RefCell;
+use std::rc::Rc;
/// Any package type.
#[derive(Debug, Clone)]
diff --git a/crates/shirabe/src/package/loader/mod.rs b/crates/shirabe/src/package/loader.rs
index 1073172..1073172 100644
--- a/crates/shirabe/src/package/loader/mod.rs
+++ b/crates/shirabe/src/package/loader.rs
diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs
index b86f1de..07ad11f 100644
--- a/crates/shirabe/src/package/loader/array_loader.rs
+++ b/crates/shirabe/src/package/loader/array_loader.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Package/Loader/ArrayLoader.php
-use anyhow::Result;
-use chrono::Utc;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- E_USER_DEPRECATED, PhpMixed, UnexpectedValueException, is_scalar, is_string, json_encode,
- ltrim, stripos, strpos, strtolower, strval, substr, trigger_error, trim,
-};
-
use crate::package::CompleteAliasPackageHandle;
use crate::package::CompletePackage;
use crate::package::CompletePackageHandle;
@@ -24,6 +15,14 @@ use crate::package::RootPackageHandle;
use crate::package::SUPPORTED_LINK_TYPES;
use crate::package::loader::LoaderInterface;
use crate::package::version::VersionParser;
+use anyhow::Result;
+use chrono::Utc;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ E_USER_DEPRECATED, PhpMixed, UnexpectedValueException, is_scalar, is_string, json_encode,
+ ltrim, stripos, strpos, strtolower, strval, substr, trigger_error, trim,
+};
#[derive(Debug)]
pub struct ArrayLoader {
diff --git a/crates/shirabe/src/package/loader/root_package_loader.rs b/crates/shirabe/src/package/loader/root_package_loader.rs
index c0101ac..83cda30 100644
--- a/crates/shirabe/src/package/loader/root_package_loader.rs
+++ b/crates/shirabe/src/package/loader/root_package_loader.rs
@@ -1,9 +1,5 @@
//! ref: composer/src/Composer/Package/Loader/RootPackageLoader.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{PhpMixed, RuntimeException, UnexpectedValueException, strtolower};
-
use crate::config::Config;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
@@ -18,6 +14,9 @@ use crate::repository::RepositoryFactory;
use crate::repository::RepositoryManager;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{PhpMixed, RuntimeException, UnexpectedValueException, strtolower};
#[derive(Debug)]
pub struct RootPackageLoader {
diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs
index 14500a6..56e4157 100644
--- a/crates/shirabe/src/package/loader/validating_array_loader.rs
+++ b/crates/shirabe/src/package/loader/validating_array_loader.rs
@@ -1,7 +1,11 @@
//! ref: composer/src/Composer/Package/Loader/ValidatingArrayLoader.php
+use crate::package::loader::InvalidPackageException;
+use crate::package::loader::LoaderInterface;
+use crate::package::version::VersionParser;
+use crate::package::{STABILITIES, SUPPORTED_LINK_TYPES};
+use crate::repository::PlatformRepository;
use indexmap::IndexMap;
-
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
E_USER_DEPRECATED, PHP_EOL, PhpMixed, array_intersect_key, array_values, filter_var_email,
@@ -14,12 +18,6 @@ use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
use shirabe_spdx_licenses::SpdxLicenses;
-use crate::package::loader::InvalidPackageException;
-use crate::package::loader::LoaderInterface;
-use crate::package::version::VersionParser;
-use crate::package::{STABILITIES, SUPPORTED_LINK_TYPES};
-use crate::repository::PlatformRepository;
-
#[derive(Debug)]
pub struct ValidatingArrayLoader {
loader: Box<dyn LoaderInterface>,
diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs
index 1f123f1..09c2def 100644
--- a/crates/shirabe/src/package/locker.rs
+++ b/crates/shirabe/src/package/locker.rs
@@ -1,16 +1,5 @@
//! ref: composer/src/Composer/Package/Locker.php
-use anyhow::Result;
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::seld::json_lint::ParsingException;
-use shirabe_php_shim::{
- DATE_RFC3339, LogicException, PhpMixed, RuntimeException, array_intersect, array_keys,
- array_map, array_merge, file_get_contents, filemtime, function_exists, hash, in_array, is_int,
- ksort, realpath, strcmp, strtolower, touch2, trim, usort,
-};
-
use crate::installer::InstallationManager;
use crate::io::IOInterface;
use crate::json::JsonEncodeOptions;
@@ -34,6 +23,15 @@ use crate::repository::RepositoryInterfaceHandle;
use crate::repository::RootPackageRepository;
use crate::util::Git as GitUtil;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::seld::json_lint::ParsingException;
+use shirabe_php_shim::{
+ DATE_RFC3339, LogicException, PhpMixed, RuntimeException, array_intersect, array_keys,
+ array_map, array_merge, file_get_contents, filemtime, function_exists, hash, in_array, is_int,
+ ksort, realpath, strcmp, strtolower, touch2, trim, usort,
+};
/// Reads/writes project lockfile (composer.lock).
#[derive(Debug)]
diff --git a/crates/shirabe/src/package/package.rs b/crates/shirabe/src/package/package.rs
index 7fa9452..6eaf348 100644
--- a/crates/shirabe/src/package/package.rs
+++ b/crates/shirabe/src/package/package.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Package/Package.php
-use std::rc::Rc;
-
-use chrono::{DateTime, Utc};
-use indexmap::{IndexMap, IndexSet};
-
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{E_USER_DEPRECATED, LogicException, PhpMixed, strpos, trigger_error};
-
use crate::package::BasePackage;
use crate::package::DisplayMode;
use crate::package::Link;
@@ -16,6 +8,11 @@ use crate::package::version::VersionParser;
use crate::repository::RepositoryInterfaceHandle;
use crate::repository::RepositoryInterfaceWeakHandle;
use crate::util::ComposerMirror;
+use chrono::{DateTime, Utc};
+use indexmap::{IndexMap, IndexSet};
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{E_USER_DEPRECATED, LogicException, PhpMixed, strpos, trigger_error};
+use std::rc::Rc;
/// Mirror entry, e.g. `['url' => 'https://...', 'preferred' => true]`.
#[derive(Debug, Clone)]
diff --git a/crates/shirabe/src/package/package_interface.rs b/crates/shirabe/src/package/package_interface.rs
index 42a2ca2..8c9213c 100644
--- a/crates/shirabe/src/package/package_interface.rs
+++ b/crates/shirabe/src/package/package_interface.rs
@@ -1,12 +1,11 @@
//! ref: composer/src/Composer/Package/PackageInterface.php
-use chrono::{DateTime, Utc};
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::package::Link;
use crate::package::Mirror;
use crate::repository::RepositoryInterfaceHandle;
+use chrono::{DateTime, Utc};
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
/// Selects how `get_full_pretty_version` renders the reference.
///
diff --git a/crates/shirabe/src/package/root_alias_package.rs b/crates/shirabe/src/package/root_alias_package.rs
index 687ee59..41b30a9 100644
--- a/crates/shirabe/src/package/root_alias_package.rs
+++ b/crates/shirabe/src/package/root_alias_package.rs
@@ -1,8 +1,5 @@
//! ref: composer/src/Composer/Package/RootAliasPackage.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::package::CompleteAliasPackage;
use crate::package::CompletePackageHandle;
use crate::package::CompletePackageInterface;
@@ -10,6 +7,8 @@ use crate::package::Link;
use crate::package::RootPackageHandle;
use crate::package::RootPackageInterface;
use crate::package::handle::delegate_package_interface_to_inner;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug, Clone)]
pub struct RootAliasPackage {
diff --git a/crates/shirabe/src/package/root_package.rs b/crates/shirabe/src/package/root_package.rs
index 3ec7cbd..d764f9e 100644
--- a/crates/shirabe/src/package/root_package.rs
+++ b/crates/shirabe/src/package/root_package.rs
@@ -1,9 +1,5 @@
//! ref: composer/src/Composer/Package/RootPackage.php
-use chrono::{DateTime, Utc};
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::package::CompletePackage;
use crate::package::CompletePackageInterface;
use crate::package::DisplayMode;
@@ -12,6 +8,9 @@ use crate::package::Mirror;
use crate::package::PackageInterface;
use crate::package::RootPackageInterface;
use crate::repository::RepositoryInterfaceHandle;
+use chrono::{DateTime, Utc};
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug, Clone)]
pub struct RootPackage {
diff --git a/crates/shirabe/src/package/root_package_interface.rs b/crates/shirabe/src/package/root_package_interface.rs
index d597555..85e5f9a 100644
--- a/crates/shirabe/src/package/root_package_interface.rs
+++ b/crates/shirabe/src/package/root_package_interface.rs
@@ -1,12 +1,10 @@
//! ref: composer/src/Composer/Package/RootPackageInterface.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
-use crate::package::PackageInterface;
-
use crate::package::CompletePackageInterface;
use crate::package::Link;
+use crate::package::PackageInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
pub trait RootPackageInterface: CompletePackageInterface {
fn get_aliases(&self) -> &[IndexMap<String, String>];
diff --git a/crates/shirabe/src/package/version/mod.rs b/crates/shirabe/src/package/version.rs
index b2f32a2..b2f32a2 100644
--- a/crates/shirabe/src/package/version/mod.rs
+++ b/crates/shirabe/src/package/version.rs
diff --git a/crates/shirabe/src/package/version/version_guesser.rs b/crates/shirabe/src/package/version/version_guesser.rs
index 6642201..f18f363 100644
--- a/crates/shirabe/src/package/version/version_guesser.rs
+++ b/crates/shirabe/src/package/version/version_guesser.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Package/Version/VersionGuesser.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PHP_INT_MAX, PhpMixed, RuntimeException, array_keys, array_map, array_merge, empty,
- function_exists, implode, is_string, json_encode, preg_quote, str_replace, strlen,
- strnatcasecmp, strpos, substr, trim, usort,
-};
-
use crate::config::Config;
use crate::io::IOInterface;
use crate::io::NullIO;
@@ -19,6 +10,14 @@ use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PHP_INT_MAX, PhpMixed, RuntimeException, array_keys, array_map, array_merge, empty,
+ function_exists, implode, is_string, json_encode, preg_quote, str_replace, strlen,
+ strnatcasecmp, strpos, substr, trim, usort,
+};
/// Seam over the parts of [`VersionGuesser`] that consumers depend on, so they can be exercised
/// with a test double. PHP has no such interface; this exists only to allow mocking the concrete
diff --git a/crates/shirabe/src/package/version/version_parser.rs b/crates/shirabe/src/package/version/version_parser.rs
index d412d47..3527722 100644
--- a/crates/shirabe/src/package/version/version_parser.rs
+++ b/crates/shirabe/src/package/version/version_parser.rs
@@ -1,14 +1,12 @@
//! ref: composer/src/Composer/Package/Version/VersionParser.php
+use crate::repository::PlatformRepository;
use indexmap::IndexMap;
-use std::sync::{LazyLock, Mutex};
-
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_semver::Semver;
use shirabe_semver::VersionParser as SemverVersionParser;
use shirabe_semver::constraint::AnyConstraint;
-
-use crate::repository::PlatformRepository;
+use std::sync::{LazyLock, Mutex};
static CONSTRAINTS: LazyLock<Mutex<IndexMap<String, AnyConstraint>>> =
LazyLock::new(|| Mutex::new(IndexMap::new()));
diff --git a/crates/shirabe/src/package/version/version_selector.rs b/crates/shirabe/src/package/version/version_selector.rs
index 8a0d037..48b045e 100644
--- a/crates/shirabe/src/package/version/version_selector.rs
+++ b/crates/shirabe/src/package/version/version_selector.rs
@@ -1,21 +1,12 @@
//! ref: composer/src/Composer/Package/Version/VersionSelector.php
-use crate::io::io_interface;
-
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, strtolower, version_compare,
-};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::filter::platform_requirement_filter::IgnoreAllPlatformRequirementFilter;
use crate::filter::platform_requirement_filter::IgnoreListPlatformRequirementFilter;
use crate::filter::platform_requirement_filter::PlatformRequirementFilterFactory;
use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::base_package;
use crate::package::dumper::ArrayDumper;
@@ -24,6 +15,13 @@ use crate::package::version::VersionParser;
use crate::repository::PlatformRepository;
use crate::repository::RepositoryInterface;
use crate::repository::RepositorySetInterface;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, strtolower, version_compare,
+};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug)]
pub struct VersionSelector {
diff --git a/crates/shirabe/src/phpstan/mod.rs b/crates/shirabe/src/phpstan.rs
index 5c48ac7..5c48ac7 100644
--- a/crates/shirabe/src/phpstan/mod.rs
+++ b/crates/shirabe/src/phpstan.rs
diff --git a/crates/shirabe/src/platform/mod.rs b/crates/shirabe/src/platform.rs
index 6abbb76..6abbb76 100644
--- a/crates/shirabe/src/platform/mod.rs
+++ b/crates/shirabe/src/platform.rs
diff --git a/crates/shirabe/src/plugin/mod.rs b/crates/shirabe/src/plugin.rs
index a26e117..a26e117 100644
--- a/crates/shirabe/src/plugin/mod.rs
+++ b/crates/shirabe/src/plugin.rs
diff --git a/crates/shirabe/src/plugin/capability/mod.rs b/crates/shirabe/src/plugin/capability.rs
index 5b7dcea..5b7dcea 100644
--- a/crates/shirabe/src/plugin/capability/mod.rs
+++ b/crates/shirabe/src/plugin/capability.rs
diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs
index a949c03..dd68d1e 100644
--- a/crates/shirabe/src/plugin/plugin_manager.rs
+++ b/crates/shirabe/src/plugin/plugin_manager.rs
@@ -4,15 +4,6 @@
//! and is not implemented in Phase A. The structure is mirrored verbatim so
//! future plugin support can fill in the runtime hooks.
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- E_USER_DEPRECATED, PhpMixed, RuntimeException, UnexpectedValueException, array_key_exists,
- get_class_obj, implode, ksort, trigger_error, trim, var_export_str, version_compare,
-};
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::composer::PartialComposerHandle;
use crate::composer::{ComposerHandle, ComposerWeakHandle};
use crate::factory::DisablePlugins;
@@ -31,6 +22,13 @@ use crate::repository::InstalledRepository;
use crate::repository::RepositoryInterface;
use crate::repository::RepositoryUtils;
use crate::util::PackageSorter;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ E_USER_DEPRECATED, PhpMixed, RuntimeException, UnexpectedValueException, array_key_exists,
+ get_class_obj, implode, ksort, trigger_error, trim, var_export_str, version_compare,
+};
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug)]
pub struct PluginManager {
diff --git a/crates/shirabe/src/plugin/post_file_download_event.rs b/crates/shirabe/src/plugin/post_file_download_event.rs
index 9ba946e..88fc181 100644
--- a/crates/shirabe/src/plugin/post_file_download_event.rs
+++ b/crates/shirabe/src/plugin/post_file_download_event.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Plugin/PostFileDownloadEvent.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::event_dispatcher::Event;
use crate::event_dispatcher::EventInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug)]
pub struct PostFileDownloadEvent {
diff --git a/crates/shirabe/src/plugin/pre_file_download_event.rs b/crates/shirabe/src/plugin/pre_file_download_event.rs
index 0cd14d7..9ec74a0 100644
--- a/crates/shirabe/src/plugin/pre_file_download_event.rs
+++ b/crates/shirabe/src/plugin/pre_file_download_event.rs
@@ -1,11 +1,10 @@
//! ref: composer/src/Composer/Plugin/PreFileDownloadEvent.php
-use indexmap::IndexMap;
-use shirabe_php_shim::PhpMixed;
-
use crate::event_dispatcher::Event;
use crate::event_dispatcher::EventInterface;
use crate::util::HttpDownloader;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug)]
pub struct PreFileDownloadEvent {
diff --git a/crates/shirabe/src/plugin/pre_pool_create_event.rs b/crates/shirabe/src/plugin/pre_pool_create_event.rs
index 303159a..0ffde94 100644
--- a/crates/shirabe/src/plugin/pre_pool_create_event.rs
+++ b/crates/shirabe/src/plugin/pre_pool_create_event.rs
@@ -1,14 +1,12 @@
//! ref: composer/src/Composer/Plugin/PrePoolCreateEvent.php
-use indexmap::IndexMap;
-
-use shirabe_php_shim::PhpMixed;
-
use crate::dependency_resolver::Request;
use crate::event_dispatcher::Event;
use crate::event_dispatcher::EventInterface;
use crate::package::BasePackageHandle;
use crate::repository::RepositoryInterface;
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
#[derive(Debug)]
pub struct PrePoolCreateEvent {
diff --git a/crates/shirabe/src/question/mod.rs b/crates/shirabe/src/question.rs
index 4fedd84..4fedd84 100644
--- a/crates/shirabe/src/question/mod.rs
+++ b/crates/shirabe/src/question.rs
diff --git a/crates/shirabe/src/repository/mod.rs b/crates/shirabe/src/repository.rs
index 478eedd..478eedd 100644
--- a/crates/shirabe/src/repository/mod.rs
+++ b/crates/shirabe/src/repository.rs
diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs
index afe2cc5..eec49f2 100644
--- a/crates/shirabe/src/repository/array_repository.rs
+++ b/crates/shirabe/src/repository/array_repository.rs
@@ -1,15 +1,5 @@
//! ref: composer/src/Composer/Repository/ArrayRepository.php
-use std::cell::RefCell;
-use std::rc::Weak;
-
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{implode, preg_quote, strtolower};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::package::AliasPackageHandle;
use crate::package::BasePackageHandle;
use crate::package::CompleteAliasPackageHandle;
@@ -21,6 +11,14 @@ use crate::repository::{
AbandonedInfo, FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface,
RepositoryInterfaceHandle, RepositoryInterfaceWeakHandle, SearchResult,
};
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{implode, preg_quote, strtolower};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
+use std::cell::RefCell;
+use std::rc::Weak;
/// A repository implementation that simply stores packages in an array
#[derive(Debug)]
diff --git a/crates/shirabe/src/repository/artifact_repository.rs b/crates/shirabe/src/repository/artifact_repository.rs
index ac83e6b..7d9c02b 100644
--- a/crates/shirabe/src/repository/artifact_repository.rs
+++ b/crates/shirabe/src/repository/artifact_repository.rs
@@ -1,15 +1,8 @@
//! ref: composer/src/Composer/Repository/ArtifactRepository.php
-use crate::io::io_interface;
-use std::path::Path;
-
-use indexmap::IndexMap;
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, UnexpectedValueException, extension_loaded, hash_file,
-};
-
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonFile;
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
@@ -24,7 +17,12 @@ use crate::repository::{
use crate::util::Platform;
use crate::util::Tar;
use crate::util::Zip;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, UnexpectedValueException, extension_loaded, hash_file,
+};
use shirabe_semver::constraint::AnyConstraint;
+use std::path::Path;
pub struct ArtifactRepository {
inner: ArrayRepository,
diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs
index 4042a9b..e3a5711 100644
--- a/crates/shirabe/src/repository/composer_repository.rs
+++ b/crates/shirabe/src/repository/composer_repository.rs
@@ -1,19 +1,5 @@
//! ref: composer/src/Composer/Repository/ComposerRepository.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_metadata_minifier::MetadataMinifier;
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, RuntimeException,
- UnexpectedValueException, extension_loaded, hash, http_build_query, in_array, json_decode,
- parse_url_all, realpath, strtolower, strtr, urlencode, var_export,
-};
-
-use shirabe_semver::CompilingMatcher;
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::MatchAllConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::advisory::{AnySecurityAdvisory, PartialSecurityAdvisory};
use crate::cache::Cache;
use crate::config::Config;
@@ -46,6 +32,18 @@ use crate::util::HttpDownloader;
use crate::util::Url;
use crate::util::http::Response;
use crate::util::r#loop::Loop;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_metadata_minifier::MetadataMinifier;
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, RuntimeException,
+ UnexpectedValueException, extension_loaded, hash, http_build_query, in_array, json_decode,
+ parse_url_all, realpath, strtolower, strtr, urlencode, var_export,
+};
+use shirabe_semver::CompilingMatcher;
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::MatchAllConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug)]
pub enum RootData {
diff --git a/crates/shirabe/src/repository/composite_repository.rs b/crates/shirabe/src/repository/composite_repository.rs
index d1456b1..9e5c975 100644
--- a/crates/shirabe/src/repository/composite_repository.rs
+++ b/crates/shirabe/src/repository/composite_repository.rs
@@ -1,14 +1,13 @@
//! ref: composer/src/Composer/Repository/CompositeRepository.php
-use indexmap::IndexMap;
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface,
RepositoryInterfaceHandle, SearchResult,
};
+use indexmap::IndexMap;
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct CompositeRepository {
@@ -147,7 +146,7 @@ impl RepositoryInterface for CompositeRepository {
all_names_found.extend(result.names_found);
}
- let mut seen = std::collections::HashSet::new();
+ let mut seen = indexmap::IndexSet::new();
let unique_names: Vec<String> = all_names_found
.into_iter()
.filter(|s| seen.insert(s.clone()))
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index 14365f2..ebe7600 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -1,17 +1,5 @@
//! ref: composer/src/Composer/Repository/FilesystemRepository.php
-use std::any::Any;
-
-use crate::util::Silencer;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- Exception, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
- array_flip, dirname, r#eval, file_get_contents, get_class_err, get_debug_type, in_array,
- is_array, is_null, is_string, ksort, realpath, str_repeat, trim, usort, var_export,
-};
-
use crate::config::is_php_integer_key;
use crate::installed_versions::InstalledVersions;
use crate::installer::InstallationManagerInterface;
@@ -29,7 +17,17 @@ use crate::repository::WritableArrayRepository;
use crate::repository::{FindPackageConstraint, LoadPackagesResult, ProviderInfo, SearchResult};
use crate::util::Filesystem;
use crate::util::Platform;
+use crate::util::Silencer;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ Exception, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
+ array_flip, dirname, r#eval, file_get_contents, get_class_err, get_debug_type, in_array,
+ is_array, is_null, is_string, ksort, realpath, str_repeat, trim, usort, var_export,
+};
use shirabe_semver::constraint::AnyConstraint;
+use std::any::Any;
/// Filesystem repository.
#[derive(Debug)]
diff --git a/crates/shirabe/src/repository/handle.rs b/crates/shirabe/src/repository/handle.rs
index d0ad774..64cb5b7 100644
--- a/crates/shirabe/src/repository/handle.rs
+++ b/crates/shirabe/src/repository/handle.rs
@@ -1,17 +1,15 @@
//! Shared handle over `RepositoryInterface`.
-use std::cell::{Ref, RefCell, RefMut};
-use std::rc::{Rc, Weak};
-
-use indexmap::IndexMap;
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
use crate::repository::{
FindPackageConstraint, LoadPackagesResult, LockArrayRepository, PlatformRepository,
ProviderInfo, RepositoryInterface, SearchResult,
};
+use indexmap::IndexMap;
+use shirabe_semver::constraint::AnyConstraint;
+use std::cell::{Ref, RefCell, RefMut};
+use std::rc::{Rc, Weak};
/// Shared reference to a repository. Corresponds to PHP `RepositoryInterface`.
#[derive(Debug, Clone)]
diff --git a/crates/shirabe/src/repository/installed_array_repository.rs b/crates/shirabe/src/repository/installed_array_repository.rs
index 6eff28f..ae0843d 100644
--- a/crates/shirabe/src/repository/installed_array_repository.rs
+++ b/crates/shirabe/src/repository/installed_array_repository.rs
@@ -1,8 +1,5 @@
//! ref: composer/src/Composer/Repository/InstalledArrayRepository.php
-use indexmap::IndexMap;
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
use crate::repository::AdvisoryProviderInterface;
@@ -12,6 +9,8 @@ use crate::repository::WritableRepositoryInterface;
use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
+use indexmap::IndexMap;
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct InstalledArrayRepository {
diff --git a/crates/shirabe/src/repository/installed_filesystem_repository.rs b/crates/shirabe/src/repository/installed_filesystem_repository.rs
index fc92aff..3cd21eb 100644
--- a/crates/shirabe/src/repository/installed_filesystem_repository.rs
+++ b/crates/shirabe/src/repository/installed_filesystem_repository.rs
@@ -1,9 +1,5 @@
//! ref: composer/src/Composer/Repository/InstalledFilesystemRepository.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::json::JsonFile;
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
@@ -16,6 +12,9 @@ use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
use crate::util::Filesystem;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct InstalledFilesystemRepository {
diff --git a/crates/shirabe/src/repository/installed_repository.rs b/crates/shirabe/src/repository/installed_repository.rs
index b17fb27..9ed8d4e 100644
--- a/crates/shirabe/src/repository/installed_repository.rs
+++ b/crates/shirabe/src/repository/installed_repository.rs
@@ -1,11 +1,5 @@
//! ref: composer/src/Composer/Repository/InstalledRepository.php
-use indexmap::IndexMap;
-use shirabe_php_shim::array_merge_map;
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::MatchAllConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::package::BasePackageHandle;
use crate::package::Link;
use crate::package::PackageInterfaceHandle;
@@ -18,6 +12,11 @@ use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface,
RepositoryInterfaceHandle, SearchResult,
};
+use indexmap::IndexMap;
+use shirabe_php_shim::array_merge_map;
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::MatchAllConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
pub enum NeedleInput {
Single(String),
diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs
index f573ee9..8249bb9 100644
--- a/crates/shirabe/src/repository/path_repository.rs
+++ b/crates/shirabe/src/repository/path_repository.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/Repository/PathRepository.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, GLOB_BRACE, GLOB_MARK, GLOB_ONLYDIR, PhpMixed, RuntimeException, defined,
- file_exists, file_get_contents, glob_with_flags, hash, realpath, serialize,
-};
-
use crate::config::Config;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
@@ -29,6 +22,12 @@ use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, GLOB_BRACE, GLOB_MARK, GLOB_ONLYDIR, PhpMixed, RuntimeException, defined,
+ file_exists, file_get_contents, glob_with_flags, hash, realpath, serialize,
+};
#[derive(Debug)]
pub struct PathRepository {
diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs
index ee1d26e..0fa5638 100644
--- a/crates/shirabe/src/repository/platform_repository.rs
+++ b/crates/shirabe/src/repository/platform_repository.rs
@@ -1,18 +1,5 @@
//! ref: composer/src/Composer/Repository/PlatformRepository.php
-use std::sync::{LazyLock, Mutex};
-
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, UnexpectedValueException, array_map_str_fn,
- array_slice_strs, explode, get_class, implode, in_array, is_string, str_replace,
- str_starts_with, strpos, strtolower, var_export,
-};
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::composer;
use crate::package::CompletePackage;
use crate::package::CompletePackageHandle;
@@ -31,6 +18,16 @@ use crate::plugin::plugin_interface::{self};
use crate::repository::ArrayRepository;
use crate::repository::RepositoryInterface;
use crate::util::Silencer;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_external_packages::composer::xdebug_handler::XdebugHandler;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, UnexpectedValueException, array_map_str_fn,
+ array_slice_strs, explode, get_class, implode, in_array, is_string, str_replace,
+ str_starts_with, strpos, strtolower, var_export,
+};
+use shirabe_semver::constraint::SimpleConstraint;
+use std::sync::{LazyLock, Mutex};
static LAST_SEEN_PLATFORM_PHP: LazyLock<Mutex<Option<String>>> = LazyLock::new(|| Mutex::new(None));
@@ -1810,8 +1807,6 @@ impl PlatformRepository {
self.inner.search(query, mode, r#type)
}
- // ---- helpers ----
-
fn is_complete_package(package: PackageInterfaceHandle) -> bool {
package.as_complete().is_some()
}
diff --git a/crates/shirabe/src/repository/repository_factory.rs b/crates/shirabe/src/repository/repository_factory.rs
index bc08589..23766bf 100644
--- a/crates/shirabe/src/repository/repository_factory.rs
+++ b/crates/shirabe/src/repository/repository_factory.rs
@@ -1,12 +1,5 @@
//! ref: composer/src/Composer/Repository/RepositoryFactory.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, UnexpectedValueException, get_debug_type, json_encode,
- php_to_string,
-};
-
use crate::config::Config;
use crate::event_dispatcher::EventDispatcher;
use crate::factory::Factory;
@@ -18,6 +11,12 @@ use crate::repository::RepositoryManager;
use crate::repository::RepositoryManagerInterface;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, UnexpectedValueException, get_debug_type, json_encode,
+ php_to_string,
+};
pub struct RepositoryFactory;
diff --git a/crates/shirabe/src/repository/repository_manager.rs b/crates/shirabe/src/repository/repository_manager.rs
index 41f4e7d..eb755dc 100644
--- a/crates/shirabe/src/repository/repository_manager.rs
+++ b/crates/shirabe/src/repository/repository_manager.rs
@@ -1,9 +1,5 @@
//! ref: composer/src/Composer/Repository/RepositoryManager.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, json_encode};
-use shirabe_semver::constraint::AnyConstraint;
-
use crate::config::Config;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
@@ -13,6 +9,9 @@ use crate::repository::FilterRepository;
use crate::repository::RepositoryInterfaceHandle;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, json_encode};
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct RepositoryManager {
diff --git a/crates/shirabe/src/repository/repository_set.rs b/crates/shirabe/src/repository/repository_set.rs
index f8514cb..c19f61a 100644
--- a/crates/shirabe/src/repository/repository_set.rs
+++ b/crates/shirabe/src/repository/repository_set.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Repository/RepositorySet.php
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_php_shim::{LogicException, RuntimeException, ksort, strtolower};
-use shirabe_semver::constraint::AnyConstraint;
-use shirabe_semver::constraint::MatchAllConstraint;
-use shirabe_semver::constraint::MultiConstraint;
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::advisory::AnySecurityAdvisory;
use crate::dependency_resolver::Pool;
use crate::dependency_resolver::PoolBuilder;
@@ -28,6 +20,13 @@ use crate::repository::InstalledRepository;
use crate::repository::LockArrayRepositoryHandle;
use crate::repository::PlatformRepository;
use crate::repository::{FindPackageConstraint, RepositoryInterfaceHandle};
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{LogicException, RuntimeException, ksort, strtolower};
+use shirabe_semver::constraint::AnyConstraint;
+use shirabe_semver::constraint::MatchAllConstraint;
+use shirabe_semver::constraint::MultiConstraint;
+use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug, Clone)]
pub struct RootAliasEntry {
diff --git a/crates/shirabe/src/repository/vcs/mod.rs b/crates/shirabe/src/repository/vcs.rs
index 5c60e0a..5c60e0a 100644
--- a/crates/shirabe/src/repository/vcs/mod.rs
+++ b/crates/shirabe/src/repository/vcs.rs
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 4d66f37..9557847 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -1,18 +1,11 @@
//! ref: composer/src/Composer/Repository/Vcs/ForgejoDriver.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, urlencode,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonEncodeOptions;
use crate::json::JsonFile;
use crate::repository::vcs::GitDriver;
@@ -21,6 +14,12 @@ use crate::util::Forgejo;
use crate::util::ForgejoRepositoryData;
use crate::util::ForgejoUrl;
use crate::util::http::Response;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, urlencode,
+};
#[derive(Debug)]
pub struct ForgejoDriver {
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index be3beff..840a2ae 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -1,19 +1,18 @@
//! ref: composer/src/Composer/Repository/Vcs/FossilDriver.php
-use crate::io::io_interface;
-use chrono::{DateTime, FixedOffset, Utc};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::repository::vcs::VcsDriverBase;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
+use chrono::{DateTime, FixedOffset, Utc};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable};
#[derive(Debug)]
pub struct FossilDriver {
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index 7a570bc..f28a005 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -1,21 +1,11 @@
//! ref: composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php
-use crate::io::io_interface;
-use anyhow::Result;
-use chrono::{DateTime, FixedOffset};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists,
- array_search_mixed, extension_loaded, http_build_query_mixed, implode, in_array, is_array,
- strpos,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonEncodeOptions;
use crate::json::JsonFile;
use crate::repository::vcs::GitDriver;
@@ -23,6 +13,15 @@ use crate::repository::vcs::VcsDriverBase;
use crate::repository::vcs::VcsDriverInterface;
use crate::util::Bitbucket;
use crate::util::http::Response;
+use anyhow::Result;
+use chrono::{DateTime, FixedOffset};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists,
+ array_search_mixed, extension_loaded, http_build_query_mixed, implode, in_array, is_array,
+ strpos,
+};
#[derive(Debug)]
pub struct GitBitbucketDriver {
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index cd08117..1455383 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -1,26 +1,25 @@
//! ref: composer/src/Composer/Repository/Vcs/GitDriver.php
-use crate::io::io_interface;
-use chrono::TimeZone;
-use chrono::{DateTime, FixedOffset, Utc};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, realpath,
- sys_get_temp_dir,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::repository::vcs::VcsDriverBase;
use crate::util::Filesystem;
use crate::util::Git as GitUtil;
use crate::util::ProcessExecutor;
use crate::util::Url;
+use chrono::TimeZone;
+use chrono::{DateTime, FixedOffset, Utc};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::PhpMixed;
+use shirabe_php_shim::{
+ InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, realpath,
+ sys_get_temp_dir,
+};
#[derive(Debug)]
pub struct GitDriver {
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index e45096d..e8e67ea 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -1,27 +1,26 @@
//! ref: composer/src/Composer/Repository/Vcs/GitHubDriver.php
-use crate::io::io_interface;
-use anyhow::Result;
-use chrono::{DateTime, FixedOffset};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_key_exists, array_map,
- array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array,
- parse_url_all, strpos, strtolower, substr, trim, urlencode,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonEncodeOptions;
use crate::json::JsonFile;
use crate::repository::vcs::GitDriver;
use crate::repository::vcs::VcsDriverBase;
use crate::util::GitHub;
use crate::util::http::Response;
+use anyhow::Result;
+use chrono::{DateTime, FixedOffset};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_key_exists, array_map,
+ array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array,
+ parse_url_all, strpos, strtolower, substr, trim, urlencode,
+};
#[derive(Debug)]
pub struct GitHubDriver {
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index a9a2fdb..136d0d6 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -1,21 +1,11 @@
//! ref: composer/src/Composer/Repository/Vcs/GitLabDriver.php
-use crate::io::io_interface;
-use anyhow::Result;
-use chrono::{DateTime, FixedOffset};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_search_mixed,
- array_shift, ctype_alnum, empty, explode, extension_loaded, implode, in_array, is_array,
- is_string, ord, strpos, strtolower,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::json::JsonEncodeOptions;
use crate::json::JsonFile;
use crate::repository::vcs::GitDriver;
@@ -23,6 +13,15 @@ use crate::repository::vcs::VcsDriverBase;
use crate::util::GitLab;
use crate::util::HttpDownloader;
use crate::util::http::Response;
+use anyhow::Result;
+use chrono::{DateTime, FixedOffset};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_search_mixed,
+ array_shift, ctype_alnum, empty, explode, extension_loaded, implode, in_array, is_array,
+ is_string, ord, strpos, strtolower,
+};
/// Driver for GitLab API, use the Git driver for local checkouts.
#[derive(Debug)]
diff --git a/crates/shirabe/src/repository/vcs/perforce_driver.rs b/crates/shirabe/src/repository/vcs/perforce_driver.rs
index cb280e5..55a8eae 100644
--- a/crates/shirabe/src/repository/vcs/perforce_driver.rs
+++ b/crates/shirabe/src/repository/vcs/perforce_driver.rs
@@ -1,9 +1,5 @@
//! ref: composer/src/Composer/Repository/Vcs/PerforceDriver.php
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{BadMethodCallException, PhpMixed, RuntimeException};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::io::IOInterface;
@@ -12,6 +8,9 @@ use crate::util::Perforce;
use crate::util::PerforceInterface;
use crate::util::ProcessExecutor;
use crate::util::http::Response;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{BadMethodCallException, PhpMixed, RuntimeException};
#[derive(Debug)]
pub struct PerforceDriver {
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 087ed9d..cb4ff87 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Repository/Vcs/SvnDriver.php
-use anyhow::Result;
-use chrono::{DateTime, FixedOffset, Utc};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_key_exists, stripos, strrpos, strtr, substr, trim,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
@@ -19,6 +11,13 @@ use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
use crate::util::Url;
+use anyhow::Result;
+use chrono::{DateTime, FixedOffset, Utc};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, array_key_exists, stripos, strrpos, strtr, substr, trim,
+};
#[derive(Debug)]
pub struct SvnDriver {
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver.rs b/crates/shirabe/src/repository/vcs/vcs_driver.rs
index 5e0715c..1dce856 100644
--- a/crates/shirabe/src/repository/vcs/vcs_driver.rs
+++ b/crates/shirabe/src/repository/vcs/vcs_driver.rs
@@ -1,10 +1,5 @@
//! ref: composer/src/Composer/Repository/Vcs/VcsDriver.php
-use chrono::{DateTime, FixedOffset};
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::TransportException;
@@ -15,6 +10,10 @@ use crate::repository::vcs::VcsDriverInterface;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
use crate::util::http::Response;
+use chrono::{DateTime, FixedOffset};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded};
#[derive(Debug)]
pub struct VcsDriverBase {
diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs
index 901276a..d799532 100644
--- a/crates/shirabe/src/repository/vcs_repository.rs
+++ b/crates/shirabe/src/repository/vcs_repository.rs
@@ -1,17 +1,11 @@
//! ref: composer/src/Composer/Repository/VcsRepository.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, in_array, str_replace, strpos};
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::config::Config;
use crate::downloader::TransportException;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
use crate::package::loader::ArrayLoader;
@@ -32,6 +26,11 @@ use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, in_array, str_replace, strpos};
+use shirabe_semver::constraint::SimpleConstraint;
// TODO(phase-c): the driver registration should be refactored later.
#[derive(Debug)]
diff --git a/crates/shirabe/src/script/mod.rs b/crates/shirabe/src/script.rs
index e8b657f..e8b657f 100644
--- a/crates/shirabe/src/script/mod.rs
+++ b/crates/shirabe/src/script.rs
diff --git a/crates/shirabe/src/self_update/mod.rs b/crates/shirabe/src/self_update.rs
index 5594811..5594811 100644
--- a/crates/shirabe/src/self_update/mod.rs
+++ b/crates/shirabe/src/self_update.rs
diff --git a/crates/shirabe/src/util/mod.rs b/crates/shirabe/src/util.rs
index bd51b66..bd51b66 100644
--- a/crates/shirabe/src/util/mod.rs
+++ b/crates/shirabe/src/util.rs
diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs
index 584ce69..8a89842 100644
--- a/crates/shirabe/src/util/auth_helper.rs
+++ b/crates/shirabe/src/util/auth_helper.rs
@@ -1,6 +1,13 @@
//! ref: composer/src/Composer/Util/AuthHelper.php
+use crate::config::Config;
+use crate::downloader::TransportException;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::util::Bitbucket;
+use crate::util::GitHub;
+use crate::util::GitLab;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -10,14 +17,6 @@ use shirabe_php_shim::{
trim,
};
-use crate::config::Config;
-use crate::downloader::TransportException;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::util::Bitbucket;
-use crate::util::GitHub;
-use crate::util::GitLab;
-
#[derive(Debug)]
pub struct AuthHelper {
pub(crate) io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
diff --git a/crates/shirabe/src/util/bitbucket.rs b/crates/shirabe/src/util/bitbucket.rs
index 8a1127a..bba16e8 100644
--- a/crates/shirabe/src/util/bitbucket.rs
+++ b/crates/shirabe/src/util/bitbucket.rs
@@ -1,16 +1,15 @@
//! ref: composer/src/Composer/Util/Bitbucket.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-use shirabe_php_shim::{LogicException, PhpMixed, time};
-
use crate::config::Config;
use crate::downloader::TransportException;
use crate::factory::Factory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_php_shim::{LogicException, PhpMixed, time};
fn transport_error_code(err: &anyhow::Error) -> Option<i64> {
err.downcast_ref::<TransportException>().map(|te| te.code)
diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs
index b224767..d21a0e7 100644
--- a/crates/shirabe/src/util/filesystem.rs
+++ b/crates/shirabe/src/util/filesystem.rs
@@ -1,5 +1,8 @@
//! ref: composer/src/Composer/Util/Filesystem.php
+use crate::util::Platform;
+use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::filesystem::exception::IOException;
use shirabe_external_packages::symfony::finder::Finder;
@@ -12,13 +15,8 @@ use shirabe_php_shim::{
str_starts_with, strlen, strpos, strtoupper, strtr, substr, substr_count, symlink, touch,
unlink, usleep, var_export,
};
-
use std::path::Path;
-use crate::util::Platform;
-use crate::util::ProcessExecutor;
-use crate::util::Silencer;
-
#[derive(Debug)]
pub struct Filesystem {
process_executor: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>,
diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs
index f30f9f7..ee9f9e6 100644
--- a/crates/shirabe/src/util/git.rs
+++ b/crates/shirabe/src/util/git.rs
@@ -1,20 +1,9 @@
//! ref: composer/src/Composer/Util/Git.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use std::sync::Mutex;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, PHP_EOL, PhpMixed, RuntimeException, array_map, clearstatcache,
- explode, implode, in_array, is_callable, is_dir, preg_quote, rawurldecode, rawurlencode,
- str_contains, str_ends_with, str_replace_array, strlen, strpos, substr, trim, version_compare,
-};
-
use crate::config::Config;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::util::Bitbucket;
use crate::util::Filesystem;
use crate::util::GitHub;
@@ -24,6 +13,15 @@ use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
use crate::util::{AuthHelper, StoreAuth};
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ InvalidArgumentException, PHP_EOL, PhpMixed, RuntimeException, array_map, clearstatcache,
+ explode, implode, in_array, is_callable, is_dir, preg_quote, rawurldecode, rawurlencode,
+ str_contains, str_ends_with, str_replace_array, strlen, strpos, substr, trim, version_compare,
+};
+use std::sync::Mutex;
#[derive(Debug)]
pub struct Git {
diff --git a/crates/shirabe/src/util/github.rs b/crates/shirabe/src/util/github.rs
index 285052e..905026a 100644
--- a/crates/shirabe/src/util/github.rs
+++ b/crates/shirabe/src/util/github.rs
@@ -1,16 +1,15 @@
//! ref: composer/src/Composer/Util/GitHub.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{PhpMixed, date, stripos, strtolower};
-
use crate::config::Config;
use crate::factory::Factory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{PhpMixed, date, stripos, strtolower};
#[derive(Debug)]
pub struct GitHub {
diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs
index a71c231..eae26f0 100644
--- a/crates/shirabe/src/util/gitlab.rs
+++ b/crates/shirabe/src/util/gitlab.rs
@@ -1,17 +1,16 @@
//! ref: composer/src/Composer/Util/GitLab.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{PhpMixed, RuntimeException, http_build_query, json_decode, time};
-
use crate::config::Config;
use crate::downloader::TransportException;
use crate::factory::Factory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::util::HttpDownloader;
use crate::util::ProcessExecutor;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{PhpMixed, RuntimeException, http_build_query, json_decode, time};
#[derive(Debug)]
pub struct GitLab {
diff --git a/crates/shirabe/src/util/http/mod.rs b/crates/shirabe/src/util/http.rs
index 19e5a86..19e5a86 100644
--- a/crates/shirabe/src/util/http/mod.rs
+++ b/crates/shirabe/src/util/http.rs
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs
index 66ca326..019a5ab 100644
--- a/crates/shirabe/src/util/http/curl_downloader.rs
+++ b/crates/shirabe/src/util/http/curl_downloader.rs
@@ -10,15 +10,6 @@
//! is preserved. Per-request TLS/proxy/IP-resolve settings that reqwest only exposes per-Client
//! are simplified to a single default Client; see the TODOs below.
-use std::sync::atomic::{AtomicBool, Ordering};
-
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{
- PhpMixed, in_array, parse_url, preg_quote, rename, strpos, substr, unlink_silent,
-};
-
use crate::config::Config;
use crate::downloader::MaxFileSizeExceededException;
use crate::downloader::TransportException;
@@ -31,6 +22,12 @@ use crate::util::http::CurlResponse;
use crate::util::http::ProxyManager;
use crate::util::http::Response;
use crate::util::{AuthHelper, PromptAuthResult, StoreAuth};
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::Preg;
+use shirabe_php_shim::{
+ PhpMixed, in_array, parse_url, preg_quote, rename, strpos, substr, unlink_silent,
+};
+use std::sync::atomic::{AtomicBool, Ordering};
/// resolve callback supplied by `HttpDownloader`. Receives the final `Response` on success.
pub type ResolveCallback = Box<dyn Fn(Response) + Send + Sync>;
diff --git a/crates/shirabe/src/util/http/curl_response.rs b/crates/shirabe/src/util/http/curl_response.rs
index cc3d21b..579bba8 100644
--- a/crates/shirabe/src/util/http/curl_response.rs
+++ b/crates/shirabe/src/util/http/curl_response.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Util/Http/CurlResponse.php
+use super::Response;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use super::Response;
-
#[derive(Debug)]
pub struct CurlResponse {
pub(crate) inner: Response,
diff --git a/crates/shirabe/src/util/http/proxy_manager.rs b/crates/shirabe/src/util/http/proxy_manager.rs
index d0ff9d9..3bc0888 100644
--- a/crates/shirabe/src/util/http/proxy_manager.rs
+++ b/crates/shirabe/src/util/http/proxy_manager.rs
@@ -1,12 +1,11 @@
//! ref: composer/src/Composer/Util/Http/ProxyManager.php
-use std::sync::atomic::{AtomicU64, Ordering};
-use std::sync::{Mutex, OnceLock};
-
use crate::downloader::TransportException;
use crate::util::NoProxyPattern;
use crate::util::http::ProxyItem;
use crate::util::http::RequestProxy;
+use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::{Mutex, OnceLock};
static INSTANCE: OnceLock<Mutex<Option<ProxyManager>>> = OnceLock::new();
diff --git a/crates/shirabe/src/util/http/request_proxy.rs b/crates/shirabe/src/util/http/request_proxy.rs
index 49aa885..1262622 100644
--- a/crates/shirabe/src/util/http/request_proxy.rs
+++ b/crates/shirabe/src/util/http/request_proxy.rs
@@ -1,13 +1,12 @@
//! ref: composer/src/Composer/Util/Http/RequestProxy.php
+use crate::downloader::TransportException;
use indexmap::IndexMap;
use shirabe_php_shim::{
CURLAUTH_BASIC, CURLOPT_NOPROXY, CURLOPT_PROXY, CURLOPT_PROXY_CAINFO, CURLOPT_PROXY_CAPATH,
CURLOPT_PROXYAUTH, CURLOPT_PROXYUSERPWD, InvalidArgumentException, PhpMixed,
};
-use crate::downloader::TransportException;
-
// contextOptions = array{http: array{proxy: string, header?: string, request_fulluri?: bool}}
type ContextOptions = IndexMap<String, IndexMap<String, PhpMixed>>;
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs
index a6b62d7..18e320c 100644
--- a/crates/shirabe/src/util/http_downloader.rs
+++ b/crates/shirabe/src/util/http_downloader.rs
@@ -1,17 +1,5 @@
//! ref: composer/src/Composer/Util/HttpDownloader.php
-use anyhow::Result;
-use indexmap::IndexMap;
-
-use crate::util::Silencer;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, array_replace_recursive, chr,
- extension_loaded, file_get_contents, function_exists, implode, is_numeric, rawurldecode,
- stream_context_create, stripos, strpos, substr, ucfirst,
-};
-use shirabe_semver::constraint::SimpleConstraint;
-
use crate::composer;
use crate::config::Config;
use crate::downloader::TransportException;
@@ -21,10 +9,20 @@ use crate::package::version::VersionParser;
use crate::util::GetResult;
use crate::util::Platform;
use crate::util::RemoteFilesystem;
+use crate::util::Silencer;
use crate::util::StreamContextFactory;
use crate::util::Url;
use crate::util::http::CurlDownloader;
use crate::util::http::Response;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ InvalidArgumentException, LogicException, PhpMixed, array_replace_recursive, chr,
+ extension_loaded, file_get_contents, function_exists, implode, is_numeric, rawurldecode,
+ stream_context_create, stripos, strpos, substr, ucfirst,
+};
+use shirabe_semver::constraint::SimpleConstraint;
/// @phpstan-type Request array{url: non-empty-string, options: mixed[], copyTo: string|null}
/// @phpstan-type Job array{id: int, status: int, request: Request, sync: bool, origin: string, resolve?: callable, reject?: callable, curl_id?: int, response?: Response, exception?: \Throwable}
diff --git a/crates/shirabe/src/util/package_sorter.rs b/crates/shirabe/src/util/package_sorter.rs
index 6e0af01..4b76c2f 100644
--- a/crates/shirabe/src/util/package_sorter.rs
+++ b/crates/shirabe/src/util/package_sorter.rs
@@ -1,10 +1,9 @@
//! ref: composer/src/Composer/Util/PackageSorter.php
-use indexmap::IndexMap;
-use shirabe_php_shim::{strnatcasecmp, version_compare};
-
use crate::package::Link;
use crate::package::PackageInterfaceHandle;
+use indexmap::IndexMap;
+use shirabe_php_shim::{strnatcasecmp, version_compare};
pub struct PackageSorter;
diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs
index d8cd39d..bd8e9e6 100644
--- a/crates/shirabe/src/util/perforce.rs
+++ b/crates/shirabe/src/util/perforce.rs
@@ -1,5 +1,10 @@
//! ref: composer/src/Composer/Util/Perforce.php
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
+use crate::util::Filesystem;
+use crate::util::Platform;
+use crate::util::ProcessExecutor;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -11,12 +16,6 @@ use shirabe_php_shim::{
strpos, strrpos, substr, time, trim,
};
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::util::Filesystem;
-use crate::util::Platform;
-use crate::util::ProcessExecutor;
-
/// @phpstan-type RepoConfig array{unique_perforce_client_name?: string, depot?: string, branch?: string, p4user?: string, p4password?: string}
#[derive(Debug)]
pub struct Perforce {
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs
index 889da6e..b3b7e2b 100644
--- a/crates/shirabe/src/util/platform.rs
+++ b/crates/shirabe/src/util/platform.rs
@@ -1,7 +1,7 @@
//! ref: composer/src/Composer/Util/Platform.php
-use std::sync::Mutex;
-
+use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use anyhow::Result;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
@@ -11,9 +11,7 @@ use shirabe_php_shim::{
posix_isatty, putenv, putenv_clear, realpath, stream_isatty, stripos, strlen, strtoupper,
substr, usleep,
};
-
-use crate::util::ProcessExecutor;
-use crate::util::Silencer;
+use std::sync::Mutex;
/// Platform helper for uniform platform-specific tests.
pub struct Platform;
diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs
index 98c3186..230695a 100644
--- a/crates/shirabe/src/util/process_executor.rs
+++ b/crates/shirabe/src/util/process_executor.rs
@@ -1,10 +1,12 @@
//! ref: composer/src/Composer/Util/ProcessExecutor.php
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::util::GitHub;
+use crate::util::Platform;
use anyhow::Result;
use indexmap::IndexMap;
-use std::sync::{LazyLock, Mutex};
-
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::seld::signal::SignalHandler;
use shirabe_external_packages::symfony::process::ExecutableFinder;
@@ -16,11 +18,7 @@ use shirabe_php_shim::{
explode, implode, in_array, is_array, is_dir, is_numeric, is_string, rtrim, sprintf,
str_replace, strcspn, strlen, strpbrk, strtolower, strtr_array, substr_replace, trim, usleep,
};
-
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::util::GitHub;
-use crate::util::Platform;
+use std::sync::{LazyLock, Mutex};
static EXECUTABLES: LazyLock<Mutex<IndexMap<String, String>>> =
LazyLock::new(|| Mutex::new(IndexMap::new()));
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs
index ca818fc..aa42f6b 100644
--- a/crates/shirabe/src/util/remote_filesystem.rs
+++ b/crates/shirabe/src/util/remote_filesystem.rs
@@ -1,17 +1,5 @@
//! ref: composer/src/Composer/Util/RemoteFilesystem.php
-use indexmap::IndexMap;
-
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PHP_VERSION_ID, PhpMixed, RuntimeException,
- STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS,
- array_replace_recursive, base64_encode, explode, extension_loaded, file_put_contents,
- filter_var_boolean, gethostbyname, http_clear_last_response_headers,
- http_get_last_response_headers, ini_get, json_decode, parse_url, preg_quote, strpos,
- strtolower, strtr, substr, trim, zlib_decode,
-};
-
use crate::config::Config;
use crate::downloader::MaxFileSizeExceededException;
use crate::downloader::TransportException;
@@ -24,6 +12,16 @@ use crate::util::StreamContextFactory;
use crate::util::Url;
use crate::util::http::ProxyManager;
use crate::util::http::Response;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PHP_URL_HOST, PHP_URL_PATH, PHP_URL_SCHEME, PHP_VERSION_ID, PhpMixed, RuntimeException,
+ STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS,
+ array_replace_recursive, base64_encode, explode, extension_loaded, file_put_contents,
+ filter_var_boolean, gethostbyname, http_clear_last_response_headers,
+ http_get_last_response_headers, ini_get, json_decode, parse_url, preg_quote, strpos,
+ strtolower, strtr, substr, trim, zlib_decode,
+};
/// Result of `RemoteFilesystem::get` — string content, `true` (for copy), or `false`.
#[derive(Debug, Clone)]
diff --git a/crates/shirabe/src/util/stream_context_factory.rs b/crates/shirabe/src/util/stream_context_factory.rs
index 0b259d7..6a40cd0 100644
--- a/crates/shirabe/src/util/stream_context_factory.rs
+++ b/crates/shirabe/src/util/stream_context_factory.rs
@@ -1,5 +1,11 @@
//! ref: composer/src/Composer/Util/StreamContextFactory.php
+use crate::composer;
+use crate::downloader::TransportException;
+use crate::repository::PlatformRepository;
+use crate::util::Filesystem;
+use crate::util::Platform;
+use crate::util::http::ProxyManager;
use indexmap::IndexMap;
use shirabe_external_packages::composer::ca_bundle::CaBundle;
use shirabe_php_shim::{
@@ -8,13 +14,6 @@ use shirabe_php_shim::{
stripos, uasort,
};
-use crate::composer;
-use crate::downloader::TransportException;
-use crate::repository::PlatformRepository;
-use crate::util::Filesystem;
-use crate::util::Platform;
-use crate::util::http::ProxyManager;
-
pub struct StreamContextFactory;
impl StreamContextFactory {
diff --git a/crates/shirabe/src/util/svn.rs b/crates/shirabe/src/util/svn.rs
index 096d8c3..5eed44d 100644
--- a/crates/shirabe/src/util/svn.rs
+++ b/crates/shirabe/src/util/svn.rs
@@ -1,8 +1,11 @@
//! ref: composer/src/Composer/Util/Svn.php
+use crate::config::Config;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
-use std::sync::Mutex;
-
+use crate::util::Platform;
+use crate::util::ProcessExecutor;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -10,12 +13,7 @@ use shirabe_php_shim::{
LogicException, PHP_URL_HOST, PhpMixed, RuntimeException, empty, implode, parse_url,
parse_url_all, stripos, strpos, trim,
};
-
-use crate::config::Config;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::util::Platform;
-use crate::util::ProcessExecutor;
+use std::sync::Mutex;
#[derive(Debug, Clone)]
pub struct SvnCredentials {
diff --git a/crates/shirabe/tests/advisory/auditor_test.rs b/crates/shirabe/tests/advisory/auditor_test.rs
index 516c4d1..c908f0b 100644
--- a/crates/shirabe/tests/advisory/auditor_test.rs
+++ b/crates/shirabe/tests/advisory/auditor_test.rs
@@ -1,5 +1,8 @@
//! ref: composer/tests/Composer/Test/Advisory/AuditorTest.php
+use crate::io_mock::{Expectation, get_io_mock};
+use crate::test_case::get_complete_package;
+use crate::test_case::get_package;
use chrono::Utc;
use indexmap::IndexMap;
use shirabe::advisory::AnySecurityAdvisory;
@@ -26,10 +29,6 @@ use shirabe_semver::VersionParser;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use crate::io_mock::{Expectation, get_io_mock};
-use crate::test_case::get_complete_package;
-use crate::test_case::get_package;
-
fn constraint(operator: &str, version: &str) -> shirabe_semver::constraint::AnyConstraint {
SimpleConstraint::new(operator.to_string(), version.to_string(), None).into()
}
diff --git a/crates/shirabe/tests/application_test.rs b/crates/shirabe/tests/application_test.rs
index d54f43b..a513189 100644
--- a/crates/shirabe/tests/application_test.rs
+++ b/crates/shirabe/tests/application_test.rs
@@ -5,9 +5,6 @@
// Symfony command-registry model), or a runtime define() of COMPOSER_DEV_WARNING_TIME,
// remain unportable.
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::command::about_command::AboutCommand;
use shirabe::command::self_update_command::SelfUpdateCommand;
use shirabe::console::application::ApplicationHandle;
@@ -18,6 +15,8 @@ use shirabe_external_packages::symfony::console::input::input_interface::InputIn
use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput;
use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
fn set_up() {
Platform::put_env("COMPOSER_DISABLE_XDEBUG_WARN", "1");
diff --git a/crates/shirabe/tests/autoload/autoload_generator_test.rs b/crates/shirabe/tests/autoload/autoload_generator_test.rs
index d5f16fb..73182a2 100644
--- a/crates/shirabe/tests/autoload/autoload_generator_test.rs
+++ b/crates/shirabe/tests/autoload/autoload_generator_test.rs
@@ -1,12 +1,8 @@
//! ref: composer/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
use indexmap::IndexMap;
use serial_test::serial;
-use tempfile::TempDir;
-
use shirabe::autoload::AutoloadGenerator;
use shirabe::composer::{ComposerHandle, PartialOrFullComposer};
use shirabe::config::Config;
@@ -23,8 +19,9 @@ use shirabe::util::r#loop::Loop;
use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::constraint::{AnyConstraint, MatchAllConstraint, SimpleConstraint};
-
-use crate::config_stub::ConfigStubBuilder;
+use std::cell::RefCell;
+use std::rc::Rc;
+use tempfile::TempDir;
/// The mock `InstallationManager::getInstallPath` used throughout the test: metapackages return
/// null, every other package returns `vendorDir/<name>(/<targetDir>)`. Registered as an installer
diff --git a/crates/shirabe/tests/cache_test.rs b/crates/shirabe/tests/cache_test.rs
index 7705714..b9644dc 100644
--- a/crates/shirabe/tests/cache_test.rs
+++ b/crates/shirabe/tests/cache_test.rs
@@ -1,13 +1,12 @@
//! ref: composer/tests/Composer/Test/CacheTest.php
-use std::cell::RefCell;
-use std::fs;
-use std::rc::Rc;
-
use shirabe::cache::{Cache, CacheMock, GcFinderMock};
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::filesystem::Filesystem;
+use std::cell::RefCell;
+use std::fs;
+use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
diff --git a/crates/shirabe/tests/command/archive_command_test.rs b/crates/shirabe/tests/command/archive_command_test.rs
index e7730b9..991f615 100644
--- a/crates/shirabe/tests/command/archive_command_test.rs
+++ b/crates/shirabe/tests/command/archive_command_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Command/ArchiveCommandTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
use indexmap::IndexMap;
use shirabe::command::BaseCommand;
use shirabe::command::archive_command::ArchiveCommand;
@@ -24,8 +22,8 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-
-use crate::config_stub::ConfigStubBuilder;
+use std::cell::RefCell;
+use std::rc::Rc;
// PHP mocks `Composer\Package\Archiver\ArchiveManager` with
// getMockBuilder(...)->disableOriginalConstructor().
diff --git a/crates/shirabe/tests/command/exec_command_test.rs b/crates/shirabe/tests/command/exec_command_test.rs
index 95649f7..03a2c7c 100644
--- a/crates/shirabe/tests/command/exec_command_test.rs
+++ b/crates/shirabe/tests/command/exec_command_test.rs
@@ -71,7 +71,7 @@ fn test_list() {
let output = app_tester.get_display();
- assert_eq!("Available binaries:\n- b\n- c\n- a (local)", output.trim(),);
+ assert_eq!("Available binaries:\n- b\n- c\n- a (local)", output.trim());
drop(tear_down);
}
diff --git a/crates/shirabe/tests/command/run_script_command_test.rs b/crates/shirabe/tests/command/run_script_command_test.rs
index 6cd4a2e..75cf678 100644
--- a/crates/shirabe/tests/command/run_script_command_test.rs
+++ b/crates/shirabe/tests/command/run_script_command_test.rs
@@ -1,9 +1,8 @@
//! ref: composer/tests/Composer/Test/Command/RunScriptCommandTest.php
-use shirabe_php_shim::PhpMixed;
-
use crate::test_case::{RunOptions, get_application_tester, init_temp_composer};
use serial_test::serial;
+use shirabe_php_shim::PhpMixed;
/// ref: RunScriptCommandTest::testDetectAndPassDevModeToEventAndToDispatching
///
diff --git a/crates/shirabe/tests/common/config_stub.rs b/crates/shirabe/tests/common/config_stub.rs
index 7566b89..bf81462 100644
--- a/crates/shirabe/tests/common/config_stub.rs
+++ b/crates/shirabe/tests/common/config_stub.rs
@@ -8,12 +8,11 @@
//! real resolution logic instead of intercepting `get`.
#![allow(dead_code)]
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
pub struct ConfigStubBuilder {
use_environment: bool,
diff --git a/crates/shirabe/tests/common/http_downloader_mock.rs b/crates/shirabe/tests/common/http_downloader_mock.rs
index 7a021f9..85d3ec8 100644
--- a/crates/shirabe/tests/common/http_downloader_mock.rs
+++ b/crates/shirabe/tests/common/http_downloader_mock.rs
@@ -1,9 +1,6 @@
//! ref: composer/tests/Composer/Test/Mock/HttpDownloaderMock.php
#![allow(dead_code)]
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,6 +9,8 @@ use shirabe::util::http_downloader::{
HttpDownloader, HttpDownloaderMockExpectation, HttpDownloaderMockHandler,
};
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
// A single HTTP request expectation as written in the PHP tests: a `url` plus an
// optional response (`status`/`body`/`headers`). `options` of `None` matches any
diff --git a/crates/shirabe/tests/common/io_mock.rs b/crates/shirabe/tests/common/io_mock.rs
index bdbe7b3..7b932a8 100644
--- a/crates/shirabe/tests/common/io_mock.rs
+++ b/crates/shirabe/tests/common/io_mock.rs
@@ -1,9 +1,5 @@
//! ref: composer/tests/Composer/Test/Mock/IOMock.php
-use std::cell::RefCell;
-use std::collections::VecDeque;
-use std::rc::Rc;
-
use shirabe::config::Config;
use shirabe::io::buffer_io::BufferIO;
use shirabe::io::io_interface;
@@ -12,6 +8,9 @@ use shirabe::util::platform::Platform;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::{PHP_EOL, PhpMixed, preg_quote};
+use std::cell::RefCell;
+use std::collections::VecDeque;
+use std::rc::Rc;
// A single entry of the IO expectation list. PHP models these as associative
// arrays (`{text, regex?}` / `{ask, reply}` / `{auth: [repo, user, pass]}`); the
diff --git a/crates/shirabe/tests/common/process_executor_mock.rs b/crates/shirabe/tests/common/process_executor_mock.rs
index b81c8bb..698d8d2 100644
--- a/crates/shirabe/tests/common/process_executor_mock.rs
+++ b/crates/shirabe/tests/common/process_executor_mock.rs
@@ -1,10 +1,9 @@
//! ref: composer/tests/Composer/Test/Mock/ProcessExecutorMock.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
// A command expectation as written in the PHP tests: either a bare command
// (`'git command'` / `['git', '--version']`) or the full
diff --git a/crates/shirabe/tests/composer_test.rs b/crates/shirabe/tests/composer_test.rs
index bffe4ce..c394f1e 100644
--- a/crates/shirabe/tests/composer_test.rs
+++ b/crates/shirabe/tests/composer_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/ComposerTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::composer::Composer;
use shirabe::config::Config;
@@ -19,6 +16,8 @@ use shirabe::repository::RepositoryManagerInterface;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe::util::process_executor::ProcessExecutor;
+use std::cell::RefCell;
+use std::rc::Rc;
fn null_io() -> Rc<RefCell<dyn IOInterface>> {
Rc::new(RefCell::new(NullIO::new()))
diff --git a/crates/shirabe/tests/config_test.rs b/crates/shirabe/tests/config_test.rs
index b7eb5a5..61a1575 100644
--- a/crates/shirabe/tests/config_test.rs
+++ b/crates/shirabe/tests/config_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/ConfigTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::advisory::Auditor;
@@ -11,6 +8,8 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::Platform;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
#[path = "common/io_mock.rs"]
#[allow(dead_code)] // io_mock exposes more helpers than this binary uses
diff --git a/crates/shirabe/tests/dependency_resolver/default_policy_test.rs b/crates/shirabe/tests/dependency_resolver/default_policy_test.rs
index 5b7995b..3757715 100644
--- a/crates/shirabe/tests/dependency_resolver/default_policy_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/default_policy_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
+use crate::test_case::get_package;
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::dependency_resolver::PolicyInterface;
@@ -13,8 +14,6 @@ use shirabe::repository::repository_set::RepositorySet;
use shirabe::util::platform::Platform;
use shirabe_semver::constraint::{AnyConstraint, SimpleConstraint};
-use crate::test_case::get_package;
-
#[allow(dead_code)]
struct Fixtures {
repository_set: RepositorySet,
diff --git a/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs b/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
index 0a6b0ca..548cb0d 100644
--- a/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
@@ -1,9 +1,5 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
-use std::cell::RefCell;
-use std::path::PathBuf;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::dependency_resolver::default_policy::DefaultPolicy;
@@ -26,6 +22,9 @@ use shirabe::repository::repository_set::{RepositorySet, RootAliasInput};
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::PREG_SPLIT_DELIM_CAPTURE;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::path::PathBuf;
+use std::rc::Rc;
/// Maps the PHP `$loadPackage` closure: pops the optional `id` from the data, loads the
/// package and records it in `package_ids` keyed by that id (erroring on duplicates).
diff --git a/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs b/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
index b5f70a1..3c4952e 100644
--- a/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
-use std::path::PathBuf;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::dependency_resolver::default_policy::DefaultPolicy;
use shirabe::dependency_resolver::pool::Pool;
@@ -17,6 +14,8 @@ use shirabe::repository::lock_array_repository::LockArrayRepository;
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::PREG_SPLIT_DELIM_CAPTURE;
use shirabe_php_shim::PhpMixed;
+use std::path::PathBuf;
+use std::rc::Rc;
fn load_package(package_data: &PhpMixed) -> BasePackageHandle {
let loader = ArrayLoader::new(None, false);
diff --git a/crates/shirabe/tests/dependency_resolver/pool_test.rs b/crates/shirabe/tests/dependency_resolver/pool_test.rs
index b2bd0db..409420b 100644
--- a/crates/shirabe/tests/dependency_resolver/pool_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/pool_test.rs
@@ -1,11 +1,10 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/PoolTest.php
+use crate::test_case::{get_package, get_version_constraint};
use indexmap::IndexMap;
use shirabe::dependency_resolver::pool::Pool;
use shirabe::package::handle::PackageInterfaceHandle;
-use crate::test_case::{get_package, get_version_constraint};
-
// ref: PoolTest::createPool
fn create_pool(packages: Vec<PackageInterfaceHandle>) -> Pool {
Pool::new(
diff --git a/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs b/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
index 44013aa..9c9f85b 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/RuleSetIteratorTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::dependency_resolver::generic_rule::GenericRule;
use shirabe::dependency_resolver::pool::Pool;
@@ -10,6 +7,8 @@ use shirabe::dependency_resolver::rule::{RULE_LEARNED, RULE_ROOT_REQUIRE, Reason
use shirabe::dependency_resolver::rule_set::RuleSet;
use shirabe::dependency_resolver::rule_set_iterator::RuleSetIterator;
use shirabe_semver::constraint::MatchAllConstraint;
+use std::cell::RefCell;
+use std::rc::Rc;
type Rules = IndexMap<i64, Vec<Rc<RefCell<Rule>>>>;
diff --git a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
index c1faa11..3ed974e 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
@@ -1,16 +1,14 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/RuleSetTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::dependency_resolver::{
GenericRule, Pool, RULE_LEARNED, RULE_ROOT_REQUIRE, ReasonData, Request, Rule, RuleSet,
};
use shirabe::repository::RepositorySet;
use shirabe_semver::constraint::{MatchAllConstraint, MatchNoneConstraint};
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
fn root_require_reason() -> ReasonData {
ReasonData::RootRequire {
diff --git a/crates/shirabe/tests/dependency_resolver/rule_test.rs b/crates/shirabe/tests/dependency_resolver/rule_test.rs
index 8216848..6bfb7bd 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/RuleTest.php
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::dependency_resolver::{
GenericRule, Pool, RULE_PACKAGE_REQUIRES, RULE_ROOT_REQUIRE, ReasonData, Request, Rule, RuleSet,
@@ -9,8 +10,6 @@ use shirabe::repository::RepositorySet;
use shirabe_php_shim::{PHP_VERSION_ID, hash_raw, unpack};
use shirabe_semver::constraint::MatchAllConstraint;
-use crate::test_case::get_package;
-
fn root_require_reason() -> ReasonData {
ReasonData::RootRequire {
package_name: String::new(),
diff --git a/crates/shirabe/tests/dependency_resolver/solver_test.rs b/crates/shirabe/tests/dependency_resolver/solver_test.rs
index 4f24003..c20fd4c 100644
--- a/crates/shirabe/tests/dependency_resolver/solver_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/solver_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/SolverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::{get_alias_package, get_package, get_version_constraint};
use indexmap::IndexMap;
use shirabe::dependency_resolver::PolicyInterface;
use shirabe::dependency_resolver::default_policy::DefaultPolicy;
@@ -18,8 +16,8 @@ use shirabe::repository::handle::{LockArrayRepositoryHandle, RepositoryInterface
use shirabe::repository::lock_array_repository::LockArrayRepository;
use shirabe::repository::repository_set::RepositorySet;
use shirabe_semver::constraint::{AnyConstraint, MatchAllConstraint, MultiConstraint};
-
-use crate::test_case::{get_alias_package, get_package, get_version_constraint};
+use std::cell::RefCell;
+use std::rc::Rc;
#[allow(dead_code)]
struct Fixtures {
diff --git a/crates/shirabe/tests/dependency_resolver/transaction_test.rs b/crates/shirabe/tests/dependency_resolver/transaction_test.rs
index 7835e47..99f31c3 100644
--- a/crates/shirabe/tests/dependency_resolver/transaction_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/transaction_test.rs
@@ -1,13 +1,12 @@
//! ref: composer/tests/Composer/Test/DependencyResolver/TransactionTest.php
+use crate::test_case::{get_alias_package, get_package, get_version_constraint};
use indexmap::IndexMap;
use shirabe::dependency_resolver::transaction::Transaction;
use shirabe::package::Link;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe_php_shim::PhpMixed;
-use crate::test_case::{get_alias_package, get_package, get_version_constraint};
-
/// PHP `new Link($source, $target, $constraint, $type)`: prettyConstraint defaults to
/// `(string) $constraint`.
fn mk_link(
diff --git a/crates/shirabe/tests/documentation_test.rs b/crates/shirabe/tests/documentation_test.rs
index 4fe9a94..7dc049c 100644
--- a/crates/shirabe/tests/documentation_test.rs
+++ b/crates/shirabe/tests/documentation_test.rs
@@ -1,11 +1,10 @@
//! ref: composer/tests/Composer/Test/DocumentationTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::console::application::ApplicationHandle;
use shirabe_external_packages::symfony::console::command::Command;
use shirabe_external_packages::symfony::console::descriptor::application_description::ApplicationDescription;
+use std::cell::RefCell;
+use std::rc::Rc;
fn get_command_name(command: &Rc<RefCell<dyn Command>>) -> String {
let mut name = command.borrow().get_name().unwrap_or_default();
diff --git a/crates/shirabe/tests/downloader/archive_downloader_test.rs b/crates/shirabe/tests/downloader/archive_downloader_test.rs
index 3543c2e..fedbae9 100644
--- a/crates/shirabe/tests/downloader/archive_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/archive_downloader_test.rs
@@ -6,9 +6,6 @@
// real Config merged with `vendor-dir`, and real CompletePackage instances with dist
// url/reference set.
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::downloader::FileDownloader;
@@ -18,6 +15,8 @@ use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe::util::HttpDownloader;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
/// ref: TestCase::getPackage (default class CompletePackage)
fn get_package(name: &str, version: &str) -> PackageInterfaceHandle {
diff --git a/crates/shirabe/tests/downloader/download_manager_test.rs b/crates/shirabe/tests/downloader/download_manager_test.rs
index e18643e..3b259c8 100644
--- a/crates/shirabe/tests/downloader/download_manager_test.rs
+++ b/crates/shirabe/tests/downloader/download_manager_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Downloader/DownloadManagerTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_stub::IOStub;
use indexmap::IndexMap;
use shirabe::downloader::DownloaderInterface;
use shirabe::downloader::download_manager::DownloadManager;
@@ -10,8 +8,8 @@ use shirabe::io::IOInterface;
use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe_php_shim::{PhpMixed, RuntimeException};
use shirabe_semver::VersionParser;
-
-use crate::io_stub::IOStub;
+use std::cell::RefCell;
+use std::rc::Rc;
// PHP mocks `Composer\Downloader\DownloaderInterface` with getMockBuilder.
mockall::mock! {
diff --git a/crates/shirabe/tests/downloader/file_downloader_test.rs b/crates/shirabe/tests/downloader/file_downloader_test.rs
index 6f7025e..ead577e 100644
--- a/crates/shirabe/tests/downloader/file_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/file_downloader_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Downloader/FileDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::get_http_downloader_mock;
+use crate::io_mock::{Expectation, get_io_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::cache::{Cache, CacheMock};
@@ -15,17 +14,16 @@ use shirabe::io::null_io::NullIO;
use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe::util::HttpDownloader;
use shirabe::util::filesystem::{Filesystem, FilesystemMock};
+use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, UnexpectedValueException,
};
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::get_http_downloader_mock;
-use crate::io_mock::{Expectation, get_io_mock};
-use shirabe::util::http_downloader::HttpDownloaderMockHandler;
-
/// ref: TestCase::getPackage (default class CompletePackage)
fn get_package(name: &str, version: &str) -> PackageInterfaceHandle {
let norm_version = VersionParser.normalize(version, None).unwrap();
diff --git a/crates/shirabe/tests/downloader/fossil_downloader_test.rs b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
index 2c47ac9..912b4b4 100644
--- a/crates/shirabe/tests/downloader/fossil_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
@@ -1,8 +1,8 @@
//! ref: composer/tests/Composer/Test/Downloader/FossilDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::get_process_executor_mock;
use shirabe::config::Config;
use shirabe::downloader::VcsDownloader;
use shirabe::downloader::fossil_downloader::FossilDownloader;
@@ -12,12 +12,10 @@ use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::{Filesystem, FilesystemMock};
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::config_stub::ConfigStubBuilder;
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::get_process_executor_mock;
-
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
.build()
diff --git a/crates/shirabe/tests/downloader/git_downloader_test.rs b/crates/shirabe/tests/downloader/git_downloader_test.rs
index 77a976e..7e98cae 100644
--- a/crates/shirabe/tests/downloader/git_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/git_downloader_test.rs
@@ -1,8 +1,9 @@
//! ref: composer/tests/Composer/Test/Downloader/GitDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::io_mock::{Expectation, get_io_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::config::Config;
@@ -17,13 +18,10 @@ use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::config_stub::ConfigStubBuilder;
-use crate::io_mock::{Expectation, get_io_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
-
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
.build()
diff --git a/crates/shirabe/tests/downloader/hg_downloader_test.rs b/crates/shirabe/tests/downloader/hg_downloader_test.rs
index 28483f5..e68dfc5 100644
--- a/crates/shirabe/tests/downloader/hg_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/hg_downloader_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Downloader/HgDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{cmd, get_process_executor_mock};
use shirabe::config::Config;
use shirabe::downloader::VcsDownloader;
use shirabe::downloader::hg_downloader::HgDownloader;
@@ -11,11 +10,10 @@ use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::{Filesystem, FilesystemMock};
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{cmd, get_process_executor_mock};
-
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
.build()
diff --git a/crates/shirabe/tests/downloader/perforce_downloader_test.rs b/crates/shirabe/tests/downloader/perforce_downloader_test.rs
index f23888a..70f28e1 100644
--- a/crates/shirabe/tests/downloader/perforce_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/perforce_downloader_test.rs
@@ -1,8 +1,8 @@
//! ref: composer/tests/Composer/Test/Downloader/PerforceDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_mock::{Expectation, get_io_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::get_process_executor_mock;
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::downloader::VcsDownloader;
@@ -14,12 +14,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::io_mock::{Expectation, get_io_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::get_process_executor_mock;
-
// A getMockBuilder('Composer\Util\Perforce') stand-in: the seam trait extracted from the
// concrete `Perforce` struct, mocked so the downloader's workflow can be verified.
mockall::mock! {
diff --git a/crates/shirabe/tests/downloader/xz_downloader_test.rs b/crates/shirabe/tests/downloader/xz_downloader_test.rs
index d69e7cc..358f896 100644
--- a/crates/shirabe/tests/downloader/xz_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/xz_downloader_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Downloader/XzDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::downloader::DownloaderInterface;
@@ -17,6 +14,8 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
/// ref: TestCase::getPackage (default class CompletePackage)
diff --git a/crates/shirabe/tests/downloader/zip_downloader_test.rs b/crates/shirabe/tests/downloader/zip_downloader_test.rs
index 055e98f..1d16f66 100644
--- a/crates/shirabe/tests/downloader/zip_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/zip_downloader_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Downloader/ZipDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_stub::IOStub;
use serial_test::serial;
use shirabe::config::Config;
use shirabe::downloader::ArchiveDownloader;
@@ -14,10 +12,10 @@ use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::{ZipArchive, ZipArchiveMock};
use shirabe_semver::VersionParser;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::io_stub::IOStub;
-
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
.build()
diff --git a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
index 9e048cf..cabb679 100644
--- a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
+++ b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
@@ -1,11 +1,8 @@
//! ref: composer/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
-
use shirabe::composer::{ComposerHandle, PartialOrFullComposer};
use shirabe::config::Config;
use shirabe::dependency_resolver::Transaction;
@@ -18,11 +15,10 @@ use shirabe::script::Event as ScriptEvent;
use shirabe::script::ScriptEvents;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
-
use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PHP_EOL;
-
-use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
fn tear_down() {
Platform::clear_env("COMPOSER_SKIP_SCRIPTS");
diff --git a/crates/shirabe/tests/factory_test.rs b/crates/shirabe/tests/factory_test.rs
index c6464de..8685861 100644
--- a/crates/shirabe/tests/factory_test.rs
+++ b/crates/shirabe/tests/factory_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/FactoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::factory::Factory;
@@ -10,6 +7,8 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::platform::Platform;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
#[path = "common/config_stub.rs"]
mod config_stub;
diff --git a/crates/shirabe/tests/installer/binary_installer_test.rs b/crates/shirabe/tests/installer/binary_installer_test.rs
index b26907d..6b3cae5 100644
--- a/crates/shirabe/tests/installer/binary_installer_test.rs
+++ b/crates/shirabe/tests/installer/binary_installer_test.rs
@@ -1,19 +1,16 @@
//! ref: composer/tests/Composer/Test/Installer/BinaryInstallerTest.php
-use std::cell::RefCell;
-use std::fs;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use base64::Engine;
-use tempfile::TempDir;
-
use shirabe::installer::BinaryInstaller;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::Filesystem;
use shirabe::util::ProcessExecutor;
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::fs;
+use std::rc::Rc;
+use tempfile::TempDir;
/// Mirror of setUp(): builds temp root/vendor/bin dirs plus a mocked IO. PHP uses a
/// PHPUnit IOInterface mock with no expectations; a NullIO is the closest analogue.
diff --git a/crates/shirabe/tests/installer/installation_manager_test.rs b/crates/shirabe/tests/installer/installation_manager_test.rs
index 7480a02..bc1fcfd 100644
--- a/crates/shirabe/tests/installer/installation_manager_test.rs
+++ b/crates/shirabe/tests/installer/installation_manager_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Installer/InstallationManagerTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use shirabe::dependency_resolver::operation::{
InstallOperation, UninstallOperation, UpdateOperation,
};
@@ -16,8 +14,8 @@ use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
diff --git a/crates/shirabe/tests/installer/installer_event_test.rs b/crates/shirabe/tests/installer/installer_event_test.rs
index 8a85cab..b3bf14d 100644
--- a/crates/shirabe/tests/installer/installer_event_test.rs
+++ b/crates/shirabe/tests/installer/installer_event_test.rs
@@ -1,14 +1,13 @@
//! ref: composer/tests/Composer/Test/Installer/InstallerEventTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::composer::{ComposerHandle, PartialOrFullComposer};
use shirabe::dependency_resolver::Transaction;
use shirabe::event_dispatcher::EventInterface;
use shirabe::installer::InstallerEvent;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
+use std::cell::RefCell;
+use std::rc::Rc;
#[test]
fn test_getter() {
diff --git a/crates/shirabe/tests/installer/library_installer_test.rs b/crates/shirabe/tests/installer/library_installer_test.rs
index b91ec51..44c7e5f 100644
--- a/crates/shirabe/tests/installer/library_installer_test.rs
+++ b/crates/shirabe/tests/installer/library_installer_test.rs
@@ -1,12 +1,7 @@
//! ref: composer/tests/Composer/Test/Installer/LibraryInstallerTest.php
-use std::cell::RefCell;
-use std::fs;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use indexmap::IndexMap;
-use tempfile::TempDir;
-
use shirabe::composer::{
ComposerHandle, PartialComposerHandle, PartialComposerWeakHandle, PartialOrFullComposer,
};
@@ -21,8 +16,10 @@ use shirabe::repository::RepositoryInterface;
use shirabe::repository::WritableRepositoryInterface;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::fs;
+use std::rc::Rc;
+use tempfile::TempDir;
// PHP mocks `Composer\Downloader\DownloadManager` with getMockBuilder and asserts its
// install/update/remove calls; here the equivalent mock is injected into the Composer via
diff --git a/crates/shirabe/tests/installer/metapackage_installer_test.rs b/crates/shirabe/tests/installer/metapackage_installer_test.rs
index 20fe8ea..8528f6a 100644
--- a/crates/shirabe/tests/installer/metapackage_installer_test.rs
+++ b/crates/shirabe/tests/installer/metapackage_installer_test.rs
@@ -3,15 +3,13 @@
//! PHP verifies the mocked repository's add/remove/hasPackage calls; here the same
//! behaviour is checked against a real InstalledArrayRepository by observing its state.
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use shirabe::installer::{InstallerInterface, MetapackageInstaller};
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::repository::{InstalledArrayRepository, RepositoryInterface};
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
diff --git a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
index fa3c8fb..1665085 100644
--- a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
+++ b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
@@ -1,17 +1,15 @@
//! ref: composer/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_mock::{Expectation, IOMock, IOMockGuard, get_io_mock};
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::installer::SuggestedPackagesReporter;
use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::io::null_io::NullIO;
use shirabe::repository::{InstalledRepository, LockArrayRepository, RepositoryInterfaceHandle};
-
-use crate::io_mock::{Expectation, IOMock, IOMockGuard, get_io_mock};
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
/// ref: SuggestedPackagesReporterTest::setUp.
///
diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
index df83f56..68ee994 100644
--- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs
+++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::downloader::DownloadManager;
@@ -14,6 +11,8 @@ use shirabe::package::handle::CompletePackageHandle;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::realpath;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
// ref: ArchiverTestCase::setUp + ArchiveManagerTest::setUp.
diff --git a/crates/shirabe/tests/package/base_package_test.rs b/crates/shirabe/tests/package/base_package_test.rs
index bd29eaa..d1bf432 100644
--- a/crates/shirabe/tests/package/base_package_test.rs
+++ b/crates/shirabe/tests/package/base_package_test.rs
@@ -1,13 +1,12 @@
//! ref: composer/tests/Composer/Test/Package/BasePackageTest.php
+use crate::test_case::get_package;
use shirabe::package::DisplayMode;
use shirabe::package::base_package::package_names_to_regexp;
use shirabe::package::handle::PackageHandle;
use shirabe::repository::{ArrayRepository, RepositoryInterfaceHandle};
use shirabe_semver::VersionParser;
-use crate::test_case::get_package;
-
fn empty_repository() -> RepositoryInterfaceHandle {
RepositoryInterfaceHandle::new(ArrayRepository::new(vec![]).unwrap())
}
diff --git a/crates/shirabe/tests/package/loader/root_package_loader_test.rs b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
index 93ee93a..6a13736 100644
--- a/crates/shirabe/tests/package/loader/root_package_loader_test.rs
+++ b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
@@ -4,9 +4,7 @@
// ProcessExecutor / VersionGuesser or require constraints whose parsing goes through a
// look-around regex the regex crate cannot compile.
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::config::Config;
@@ -23,8 +21,8 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-
-use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
fn null_io() -> Rc<RefCell<dyn IOInterface>> {
Rc::new(RefCell::new(NullIO::new()))
diff --git a/crates/shirabe/tests/package/loader/validating_array_loader_test.rs b/crates/shirabe/tests/package/loader/validating_array_loader_test.rs
index aeafefd..0acf768 100644
--- a/crates/shirabe/tests/package/loader/validating_array_loader_test.rs
+++ b/crates/shirabe/tests/package/loader/validating_array_loader_test.rs
@@ -1,12 +1,11 @@
//! ref: composer/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php
+use crate::test_case;
use indexmap::IndexMap;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe::package::loader::{InvalidPackageException, LoaderInterface, ValidatingArrayLoader};
use shirabe_php_shim::PhpMixed;
-use crate::test_case;
-
fn s(v: &str) -> PhpMixed {
PhpMixed::String(v.to_string())
}
diff --git a/crates/shirabe/tests/package/locker_test.rs b/crates/shirabe/tests/package/locker_test.rs
index f70b79e..bbc333e 100644
--- a/crates/shirabe/tests/package/locker_test.rs
+++ b/crates/shirabe/tests/package/locker_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Package/LockerTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::installer::InstallationManager;
@@ -17,6 +14,8 @@ use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe::util::process_executor::ProcessExecutor;
use shirabe_php_shim::{LogicException, PhpMixed, hash};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
fn null_io() -> Rc<RefCell<dyn IOInterface>> {
diff --git a/crates/shirabe/tests/package/version/version_guesser_test.rs b/crates/shirabe/tests/package/version/version_guesser_test.rs
index 6bfe6c1..1a3f23c 100644
--- a/crates/shirabe/tests/package/version/version_guesser_test.rs
+++ b/crates/shirabe/tests/package/version/version_guesser_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Package/Version/VersionGuesserTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::config::Config;
@@ -11,8 +9,8 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-
-use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
// Mirrors VersionGuesserTest::setUp/tearDown: reset GitUtil's cached `version`
// static so each test re-runs `git --version` against its own mock.
diff --git a/crates/shirabe/tests/package/version/version_selector_test.rs b/crates/shirabe/tests/package/version/version_selector_test.rs
index 8e0912e..3a0c701 100644
--- a/crates/shirabe/tests/package/version/version_selector_test.rs
+++ b/crates/shirabe/tests/package/version/version_selector_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Package/Version/VersionSelectorTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::filter::platform_requirement_filter::PlatformRequirementFilterFactory;
use shirabe::io::BufferIO;
@@ -17,13 +15,12 @@ use shirabe::package::version::VersionSelector;
use shirabe::package::version::version_parser::VersionParser;
use shirabe::repository::PlatformRepository;
use shirabe::repository::RepositorySetInterface;
+use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PhpMixed;
use shirabe_php_shim::{PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION};
use shirabe_semver::constraint::AnyConstraint;
-
-use shirabe_external_packages::symfony::console::output::output_interface;
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
mockall::mock! {
RepositorySet {}
diff --git a/crates/shirabe/tests/question/strict_confirmation_question_test.rs b/crates/shirabe/tests/question/strict_confirmation_question_test.rs
index de8911b..d8606eb 100644
--- a/crates/shirabe/tests/question/strict_confirmation_question_test.rs
+++ b/crates/shirabe/tests/question/strict_confirmation_question_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::question::StrictConfirmationQuestion;
use shirabe_external_packages::symfony::console::helper::question_helper::QuestionHelper;
use shirabe_external_packages::symfony::console::input::array_input::ArrayInput;
@@ -10,6 +7,8 @@ use shirabe_external_packages::symfony::console::input::streamable_input_interfa
use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface;
use shirabe_external_packages::symfony::console::output::stream_output::StreamOutput;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
const TRUE_ANSWER_REGEX: &str = "/^y(?:es)?$/i";
const FALSE_ANSWER_REGEX: &str = "/^no?$/i";
diff --git a/crates/shirabe/tests/repository/array_repository_test.rs b/crates/shirabe/tests/repository/array_repository_test.rs
index 1612b7c..ae6725d 100644
--- a/crates/shirabe/tests/repository/array_repository_test.rs
+++ b/crates/shirabe/tests/repository/array_repository_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/ArrayRepositoryTest.php
+use crate::test_case::{get_alias_package, get_package};
use indexmap::IndexMap;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe::package::loader::array_loader::ArrayLoader;
@@ -8,8 +9,6 @@ use shirabe::repository::{
};
use shirabe_php_shim::PhpMixed;
-use crate::test_case::{get_alias_package, get_package};
-
/// PHP `setType`/`setAbandoned` operate on non-root packages; the public handle API only allows
/// such setters on root packages, so packages carrying extra config are built via ArrayLoader.
fn loaded(name: &str, version: &str, extra: Vec<(&str, PhpMixed)>) -> PackageInterfaceHandle {
diff --git a/crates/shirabe/tests/repository/artifact_repository_test.rs b/crates/shirabe/tests/repository/artifact_repository_test.rs
index 90e5625..558ee8b 100644
--- a/crates/shirabe/tests/repository/artifact_repository_test.rs
+++ b/crates/shirabe/tests/repository/artifact_repository_test.rs
@@ -1,12 +1,11 @@
//! ref: composer/tests/Composer/Test/Repository/ArtifactRepositoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::io::{IOInterface, NullIO};
use shirabe::repository::ArtifactRepository;
use shirabe_php_shim::{PhpMixed, extension_loaded};
+use std::cell::RefCell;
+use std::rc::Rc;
/// Returns true when the test should be skipped because the zip extension is
/// unavailable, mirroring PHP's markTestSkipped in setUp.
diff --git a/crates/shirabe/tests/repository/composer_repository_test.rs b/crates/shirabe/tests/repository/composer_repository_test.rs
index ae82b24..8e5a7f1 100644
--- a/crates/shirabe/tests/repository/composer_repository_test.rs
+++ b/crates/shirabe/tests/repository/composer_repository_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/ComposerRepositoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -13,10 +11,10 @@ use shirabe::repository::composer_repository::{ComposerRepository, ProviderListi
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::constraint::{AnyConstraint, SimpleConstraint};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
-
// Mirrors PHP's `['url' => .., 'body' => ..]` mock entry (status defaults to 200,
// options match any executed options).
fn http_body(
diff --git a/crates/shirabe/tests/repository/composite_repository_test.rs b/crates/shirabe/tests/repository/composite_repository_test.rs
index eed01f6..5fa0fb8 100644
--- a/crates/shirabe/tests/repository/composite_repository_test.rs
+++ b/crates/shirabe/tests/repository/composite_repository_test.rs
@@ -1,13 +1,12 @@
//! ref: composer/tests/Composer/Test/Repository/CompositeRepositoryTest.php
+use crate::test_case::get_package;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe::repository::{
ArrayRepository, CompositeRepository, FindPackageConstraint, RepositoryInterface,
RepositoryInterfaceHandle, SEARCH_FULLTEXT,
};
-use crate::test_case::get_package;
-
fn array_repo(packages: Vec<PackageInterfaceHandle>) -> RepositoryInterfaceHandle {
RepositoryInterfaceHandle::new(ArrayRepository::new(packages).unwrap())
}
diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs
index 7459486..e8bdddb 100644
--- a/crates/shirabe/tests/repository/filesystem_repository_test.rs
+++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/FilesystemRepositoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::{get_alias_package, get_package};
use indexmap::IndexMap;
use shirabe::dependency_resolver::operation::OperationInterface;
use shirabe::installed_versions::InstalledVersions;
@@ -17,8 +15,8 @@ use shirabe::repository::filesystem_repository::FilesystemRepository;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-
-use crate::test_case::{get_alias_package, get_package};
+use std::cell::RefCell;
+use std::rc::Rc;
/// PHP mocks JsonFile::read()/exists(); without a mocking framework the canned read value is
/// materialized as a real temp file whose decoded JSON reproduces the mock return value exactly.
diff --git a/crates/shirabe/tests/repository/filter_repository_test.rs b/crates/shirabe/tests/repository/filter_repository_test.rs
index a244f52..4a6c112 100644
--- a/crates/shirabe/tests/repository/filter_repository_test.rs
+++ b/crates/shirabe/tests/repository/filter_repository_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/FilterRepositoryTest.php
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::package::base_package::STABILITIES;
use shirabe::repository::{
@@ -8,8 +9,6 @@ use shirabe::repository::{
};
use shirabe_semver::constraint::{AnyConstraint, MatchAllConstraint};
-use crate::test_case::get_package;
-
fn set_up() -> RepositoryInterfaceHandle {
let repo = ArrayRepository::new(vec![
get_package("foo/aaa", "1.0.0"),
diff --git a/crates/shirabe/tests/repository/installed_repository_test.rs b/crates/shirabe/tests/repository/installed_repository_test.rs
index ec56b5f..5aa85e9 100644
--- a/crates/shirabe/tests/repository/installed_repository_test.rs
+++ b/crates/shirabe/tests/repository/installed_repository_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/InstalledRepositoryTest.php
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe::package::loader::array_loader::ArrayLoader;
@@ -9,8 +10,6 @@ use shirabe::repository::{
};
use shirabe_php_shim::PhpMixed;
-use crate::test_case::get_package;
-
/// PHP `setReplaces`/`setProvides` operate on non-root packages; the public handle API only allows
/// link setters on root packages, so packages carrying links are built via ArrayLoader.
fn loaded(name: &str, version: &str, extra: Vec<(&str, PhpMixed)>) -> PackageInterfaceHandle {
diff --git a/crates/shirabe/tests/repository/path_repository_test.rs b/crates/shirabe/tests/repository/path_repository_test.rs
index bbf4938..f86d659 100644
--- a/crates/shirabe/tests/repository/path_repository_test.rs
+++ b/crates/shirabe/tests/repository/path_repository_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/PathRepositoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::test_case::get_package;
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::{IOInterface, NullIO};
@@ -13,8 +11,8 @@ use shirabe::util::{Platform, ProcessExecutor};
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, PhpMixed, file_get_contents, hash, realpath, serialize,
};
-
-use crate::test_case::get_package;
+use std::cell::RefCell;
+use std::rc::Rc;
fn fixtures_dir() -> String {
format!(
diff --git a/crates/shirabe/tests/repository/repository_factory_test.rs b/crates/shirabe/tests/repository/repository_factory_test.rs
index b1a9001..ef52380 100644
--- a/crates/shirabe/tests/repository/repository_factory_test.rs
+++ b/crates/shirabe/tests/repository/repository_factory_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Repository/RepositoryFactoryTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -10,6 +7,8 @@ use shirabe::io::null_io::NullIO;
use shirabe::repository::RepositoryFactory;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
#[test]
fn test_manager_with_all_repository_types() {
diff --git a/crates/shirabe/tests/repository/repository_manager_test.rs b/crates/shirabe/tests/repository/repository_manager_test.rs
index 732b598..089ce9a 100644
--- a/crates/shirabe/tests/repository/repository_manager_test.rs
+++ b/crates/shirabe/tests/repository/repository_manager_test.rs
@@ -4,9 +4,6 @@
// curl_multi_init, todo!()) with a mocked IO/Config/EventDispatcher and exercise repo
// creation/prepending/wrapping.
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -15,6 +12,8 @@ use shirabe::repository::{ArrayRepository, RepositoryInterfaceHandle, Repository
use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
diff --git a/crates/shirabe/tests/repository/repository_utils_test.rs b/crates/shirabe/tests/repository/repository_utils_test.rs
index 1c690e9..a53bb37 100644
--- a/crates/shirabe/tests/repository/repository_utils_test.rs
+++ b/crates/shirabe/tests/repository/repository_utils_test.rs
@@ -1,13 +1,12 @@
//! ref: composer/tests/Composer/Test/Repository/RepositoryUtilsTest.php
+use crate::test_case::{get_alias_package, get_package};
use indexmap::IndexMap;
use shirabe::package::handle::PackageInterfaceHandle;
use shirabe::package::loader::array_loader::ArrayLoader;
use shirabe::repository::RepositoryUtils;
use shirabe_php_shim::PhpMixed;
-use crate::test_case::{get_alias_package, get_package};
-
/// PHP `configureLinks` sets link arrays on non-root packages; the public handle API only allows
/// link setters on root packages, so packages carrying links are built via ArrayLoader.
fn load_with(
diff --git a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
index 2e36833..296309f 100644
--- a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/ForgejoDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
+use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,11 +11,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
-use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
-
struct SetUp {
home: TempDir,
config: Rc<RefCell<Config>>,
diff --git a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
index a3986c2..1a5a425 100644
--- a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -10,6 +7,8 @@ use shirabe::io::null_io::NullIO;
use shirabe::repository::vcs::FossilDriver;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
diff --git a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
index 5bf3ee4..124d529 100644
--- a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
+use crate::io_stub::IOStub;
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,11 +11,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::ProcessExecutor;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed, RuntimeException};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-
struct SetUp {
home: TempDir,
config: Config,
diff --git a/crates/shirabe/tests/repository/vcs/git_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
index 7c30b21..be26dd1 100644
--- a/crates/shirabe/tests/repository/vcs/git_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
@@ -1,8 +1,8 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::config::Config;
@@ -13,12 +13,10 @@ use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
-
struct SetUp {
home: TempDir,
config: Config,
diff --git a/crates/shirabe/tests/repository/vcs/github_driver_test.rs b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
index f1084f5..11da393 100644
--- a/crates/shirabe/tests/repository/vcs/github_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
@@ -1,8 +1,10 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{
+ ProcessExecutorMockGuard, cmd, cmd_full, get_process_executor_mock,
+};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::config::ConfigSourceInterface;
@@ -13,14 +15,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{
- ProcessExecutorMockGuard, cmd, cmd_full, get_process_executor_mock,
-};
-
struct SetUp {
home: TempDir,
config: Config,
diff --git a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
index 437617b..f364863 100644
--- a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
+use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -11,9 +10,8 @@ use shirabe::repository::vcs::GitLabDriver;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::{PhpMixed, extension_loaded};
-
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, expect_full, get_http_downloader_mock};
-use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
// Mirrors GitLabDriverTest::setUp's `gitlab-domains` configuration.
fn make_config() -> Config {
diff --git a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
index f00cb9d..5e16c67 100644
--- a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
@@ -1,8 +1,8 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/HgDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,12 +12,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
-
struct SetUp {
home: TempDir,
config: Config,
diff --git a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
index ef55c75..13b36a3 100644
--- a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
@@ -1,8 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,10 +10,10 @@ use shirabe::util::HttpDownloader;
use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::process_executor_mock::{ProcessExecutorMockGuard, get_process_executor_mock};
-
const TEST_URL: &str = "TEST_PERFORCE_URL";
const TEST_DEPOT: &str = "TEST_DEPOT_CONFIG";
const TEST_BRANCH: &str = "TEST_BRANCH_CONFIG";
diff --git a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
index a1e79fc..70eeead 100644
--- a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
@@ -1,8 +1,8 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -12,12 +12,10 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
+use std::cell::RefCell;
+use std::rc::Rc;
use tempfile::TempDir;
-use crate::http_downloader_mock::{HttpDownloaderMockGuard, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{ProcessExecutorMockGuard, cmd_full, get_process_executor_mock};
-
struct SetUp {
home: TempDir,
config: Config,
diff --git a/crates/shirabe/tests/repository/vcs_repository_test.rs b/crates/shirabe/tests/repository/vcs_repository_test.rs
index e3b0e84..ed705e8 100644
--- a/crates/shirabe/tests/repository/vcs_repository_test.rs
+++ b/crates/shirabe/tests/repository/vcs_repository_test.rs
@@ -1,11 +1,6 @@
//! ref: composer/tests/Composer/Test/Repository/VcsRepositoryTest.php
-use std::cell::RefCell;
-use std::collections::HashSet;
-use std::process::Command;
-use std::rc::Rc;
-
-use indexmap::IndexMap;
+use indexmap::{IndexMap, IndexSet};
use serial_test::serial;
use shirabe::config::Config;
use shirabe::io::IOInterface;
@@ -16,6 +11,9 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::process::Command;
+use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -175,7 +173,7 @@ fn test_load_versions() {
let composer_home = set_up.composer_home.path().to_path_buf();
let git_repo = set_up.git_repo.path().to_path_buf();
- let mut expected: HashSet<String> = [
+ let mut expected: IndexSet<String> = [
"0.6.0",
"1.0.0",
"1.0.x-dev",
@@ -238,7 +236,11 @@ fn test_load_versions() {
for package in &packages {
let pretty = package.get_pretty_version();
- assert!(expected.remove(&pretty), "Unexpected version {}", pretty);
+ assert!(
+ expected.shift_remove(&pretty),
+ "Unexpected version {}",
+ pretty
+ );
}
assert!(
diff --git a/crates/shirabe/tests/script/event_test.rs b/crates/shirabe/tests/script/event_test.rs
index d143bd2..e249269 100644
--- a/crates/shirabe/tests/script/event_test.rs
+++ b/crates/shirabe/tests/script/event_test.rs
@@ -1,8 +1,5 @@
//! ref: composer/tests/Composer/Test/Script/EventTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::composer::{ComposerHandle, PartialOrFullComposer};
use shirabe::config::Config;
@@ -12,6 +9,8 @@ use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::package::{RootPackageHandle, RootPackageInterfaceHandle};
use shirabe::script::{Event, OriginatingEvent};
+use std::cell::RefCell;
+use std::rc::Rc;
fn create_composer_instance() -> ComposerHandle {
let composer =
diff --git a/crates/shirabe/tests/util/auth_helper_test.rs b/crates/shirabe/tests/util/auth_helper_test.rs
index 7738afb..905cbf7 100644
--- a/crates/shirabe/tests/util/auth_helper_test.rs
+++ b/crates/shirabe/tests/util/auth_helper_test.rs
@@ -1,17 +1,15 @@
//! ref: composer/tests/Composer/Test/Util/AuthHelperTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::io_mock::{Expectation, IOMock, get_io_mock};
use indexmap::IndexMap;
use shirabe::config::ConfigSourceInterface;
use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::{AuthHelper, Bitbucket, StoreAuth};
use shirabe_php_shim::{PhpMixed, base64_encode, json_encode};
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::io_mock::{Expectation, IOMock, get_io_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
// Mirrors AuthHelperTest::setUp: a DEBUG-verbosity IOMock plus a real Config, both
// shared with the AuthHelper under test. The IOMockGuard runs assert_complete on drop.
diff --git a/crates/shirabe/tests/util/bitbucket_test.rs b/crates/shirabe/tests/util/bitbucket_test.rs
index 2817266..db45b3e 100644
--- a/crates/shirabe/tests/util/bitbucket_test.rs
+++ b/crates/shirabe/tests/util/bitbucket_test.rs
@@ -1,8 +1,9 @@
//! ref: composer/tests/Composer/Test/Util/BitbucketTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
+use crate::io_mock::{Expectation, IOMock, get_io_mock};
+use crate::process_executor_mock::get_process_executor_mock;
use indexmap::IndexMap;
use shirabe::config::{Config, ConfigSourceInterface};
use shirabe::io::IOInterface;
@@ -13,11 +14,8 @@ use shirabe::util::http_downloader::{
};
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, time};
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
-use crate::io_mock::{Expectation, IOMock, get_io_mock};
-use crate::process_executor_mock::get_process_executor_mock;
+use std::cell::RefCell;
+use std::rc::Rc;
const USERNAME: &str = "username";
const PASSWORD: &str = "password";
diff --git a/crates/shirabe/tests/util/config_validator_test.rs b/crates/shirabe/tests/util/config_validator_test.rs
index 94e5792..6d7aaf8 100644
--- a/crates/shirabe/tests/util/config_validator_test.rs
+++ b/crates/shirabe/tests/util/config_validator_test.rs
@@ -1,12 +1,11 @@
//! ref: composer/tests/Composer/Test/Util/ConfigValidatorTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::io::io_interface::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::package::loader::validating_array_loader::ValidatingArrayLoader;
use shirabe::util::config_validator::ConfigValidator;
+use std::cell::RefCell;
+use std::rc::Rc;
fn fixture(name: &str) -> String {
format!(
diff --git a/crates/shirabe/tests/util/forgejo_test.rs b/crates/shirabe/tests/util/forgejo_test.rs
index a1a8f9c..106cdab 100644
--- a/crates/shirabe/tests/util/forgejo_test.rs
+++ b/crates/shirabe/tests/util/forgejo_test.rs
@@ -1,18 +1,16 @@
//! ref: composer/tests/Composer/Test/Util/ForgejoTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
+use crate::io_mock::{Expectation, IOMock, get_io_mock};
use shirabe::config::{Config, ConfigSourceInterface};
use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::Forgejo;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe_php_shim::PhpMixed;
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
-use crate::io_mock::{Expectation, IOMock, get_io_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
const USERNAME: &str = "username";
const ACCESS_TOKEN: &str = "access-token";
diff --git a/crates/shirabe/tests/util/git_test.rs b/crates/shirabe/tests/util/git_test.rs
index 80037da..43af80a 100644
--- a/crates/shirabe/tests/util/git_test.rs
+++ b/crates/shirabe/tests/util/git_test.rs
@@ -1,8 +1,9 @@
//! ref: composer/tests/Composer/Test/Util/GitTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use shirabe::config::{Config, ConfigSourceInterface};
use shirabe::io::IOInterface;
@@ -11,11 +12,8 @@ use shirabe::util::git::Git;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::{PhpMixed, RuntimeException};
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
// No-op ConfigSourceInterface, equivalent to PHPUnit's
// `getMockBuilder(Config::class)` auto-stubbing getConfigSource/getAuthConfigSource:
diff --git a/crates/shirabe/tests/util/github_test.rs b/crates/shirabe/tests/util/github_test.rs
index 0069a9c..b9abeb2 100644
--- a/crates/shirabe/tests/util/github_test.rs
+++ b/crates/shirabe/tests/util/github_test.rs
@@ -1,18 +1,16 @@
//! ref: composer/tests/Composer/Test/Util/GitHubTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
+use crate::io_mock::{Expectation, IOMock, get_io_mock};
use shirabe::config::{Config, ConfigSourceInterface};
use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::GitHub;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe_php_shim::PhpMixed;
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
-use crate::io_mock::{Expectation, IOMock, get_io_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
const PASSWORD: &str = "password";
const MESSAGE: &str = "mymessage";
diff --git a/crates/shirabe/tests/util/gitlab_test.rs b/crates/shirabe/tests/util/gitlab_test.rs
index a3db85b..46c0358 100644
--- a/crates/shirabe/tests/util/gitlab_test.rs
+++ b/crates/shirabe/tests/util/gitlab_test.rs
@@ -1,18 +1,16 @@
//! ref: composer/tests/Composer/Test/Util/GitLabTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
+use crate::io_mock::{Expectation, IOMock, get_io_mock};
use shirabe::config::{Config, ConfigSourceInterface};
use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::GitLab;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe_php_shim::PhpMixed;
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::http_downloader_mock::{expect_full, get_http_downloader_mock};
-use crate::io_mock::{Expectation, IOMock, get_io_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
const USERNAME: &str = "username";
const PASSWORD: &str = "password";
diff --git a/crates/shirabe/tests/util/http_downloader_test.rs b/crates/shirabe/tests/util/http_downloader_test.rs
index 078fd57..b184184 100644
--- a/crates/shirabe/tests/util/http_downloader_test.rs
+++ b/crates/shirabe/tests/util/http_downloader_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Util/HttpDownloaderTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::io_mock::{Expectation, get_io_mock};
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::downloader::TransportException;
@@ -13,9 +12,8 @@ use shirabe::util::Platform;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_external_packages::symfony::console::output::output_interface::VERBOSITY_NORMAL;
use shirabe_php_shim::{PHP_EOL, PhpMixed};
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::io_mock::{Expectation, get_io_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
// PHP performs a live HTTP get to assert the URL's user:pass is captured via
// setAuthentication. The credential capture happens in `add_job`, before any
diff --git a/crates/shirabe/tests/util/perforce_test.rs b/crates/shirabe/tests/util/perforce_test.rs
index 482094f..b6f8f11 100644
--- a/crates/shirabe/tests/util/perforce_test.rs
+++ b/crates/shirabe/tests/util/perforce_test.rs
@@ -1,8 +1,7 @@
//! ref: composer/tests/Composer/Test/Util/PerforceTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::io_stub::IOStub;
+use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
use indexmap::IndexMap;
use serial_test::serial;
use shirabe::io::{IOInterface, NullIO};
@@ -10,9 +9,8 @@ use shirabe::util::Perforce;
use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-
-use crate::io_stub::IOStub;
-use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock};
+use std::cell::RefCell;
+use std::rc::Rc;
const TEST_DEPOT: &str = "depot";
const TEST_BRANCH: &str = "branch";
diff --git a/crates/shirabe/tests/util/process_executor_test.rs b/crates/shirabe/tests/util/process_executor_test.rs
index 01e37ed..78c5f9f 100644
--- a/crates/shirabe/tests/util/process_executor_test.rs
+++ b/crates/shirabe/tests/util/process_executor_test.rs
@@ -4,9 +4,6 @@
// password hiding, line splitting and argument escaping; the subprocess execution and mocked
// IO are not ported.
-use std::cell::RefCell;
-use std::rc::Rc;
-
use shirabe::io::ConsoleIO;
use shirabe::io::IOInterface;
use shirabe::io::buffer_io::BufferIO;
@@ -19,6 +16,8 @@ use shirabe_external_packages::symfony::console::output::output_interface::{
OutputInterface, VERBOSITY_DEBUG, VERBOSITY_NORMAL,
};
use shirabe_php_shim::{PHP_EOL, trim};
+use std::cell::RefCell;
+use std::rc::Rc;
#[test]
fn test_execute_captures_output() {
diff --git a/crates/shirabe/tests/util/remote_filesystem_test.rs b/crates/shirabe/tests/util/remote_filesystem_test.rs
index a5d9d66..ba79757 100644
--- a/crates/shirabe/tests/util/remote_filesystem_test.rs
+++ b/crates/shirabe/tests/util/remote_filesystem_test.rs
@@ -1,15 +1,13 @@
//! ref: composer/tests/Composer/Test/Util/RemoteFilesystemTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
+use crate::config_stub::ConfigStubBuilder;
+use crate::io_stub::IOStub;
use indexmap::IndexMap;
use shirabe::io::IOInterface;
use shirabe::util::RemoteFilesystem;
use shirabe_php_shim::{PhpMixed, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS, strpos};
-
-use crate::config_stub::ConfigStubBuilder;
-use crate::io_stub::IOStub;
+use std::cell::RefCell;
+use std::rc::Rc;
// Mirrors RemoteFilesystemTest::getConfigMock: get('github-domains') and
// get('gitlab-domains') return [], everything else returns null. add_authentication_options
diff --git a/crates/shirabe/tests/util/svn_test.rs b/crates/shirabe/tests/util/svn_test.rs
index 7a30d8b..f700634 100644
--- a/crates/shirabe/tests/util/svn_test.rs
+++ b/crates/shirabe/tests/util/svn_test.rs
@@ -1,14 +1,13 @@
//! ref: composer/tests/Composer/Test/Util/SvnTest.php
-use std::cell::RefCell;
-use std::rc::Rc;
-
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::svn::Svn;
use shirabe_php_shim::PhpMixed;
+use std::cell::RefCell;
+use std::rc::Rc;
fn map(pairs: Vec<(&str, PhpMixed)>) -> IndexMap<String, PhpMixed> {
pairs.into_iter().map(|(k, v)| (k.to_string(), v)).collect()