From 96d94b321a11056d583aa3cc72a3b9ff1c90d0ca Mon Sep 17 00:00:00 2001 From: Trusted97 Date: Thu, 27 Nov 2025 16:52:21 +0100 Subject: [PATCH 1/4] test: improving code coverage for SatisCommandBuilder and LockProcessor --- config/reference.php | 1355 +++++++++++++++++++++ src/Event/BuildEvent.php | 2 +- src/Service/SatisManager.php | 7 +- tests/Service/LockProcessorTest.php | 81 ++ tests/Service/SatisCommandBuilderTest.php | 70 ++ 5 files changed, 1512 insertions(+), 3 deletions(-) create mode 100644 config/reference.php create mode 100644 tests/Service/LockProcessorTest.php create mode 100644 tests/Service/SatisCommandBuilderTest.php diff --git a/config/reference.php b/config/reference.php new file mode 100644 index 0000000..599a33d --- /dev/null +++ b/config/reference.php @@ -0,0 +1,1355 @@ + [ + * 'App\\' => [ + * 'resource' => '../src/', + * ], + * ], + * ]); + * ``` + * + * @psalm-type ImportsConfig = list + * @psalm-type ParametersConfig = array|null>|null> + * @psalm-type ArgumentsType = list|array + * @psalm-type CallType = array|array{0:string, 1?:ArgumentsType, 2?:bool}|array{method:string, arguments?:ArgumentsType, returns_clone?:bool} + * @psalm-type TagsType = list>> // arrays inside the list must have only one element, with the tag name as the key + * @psalm-type CallbackType = string|array{0:string|ReferenceConfigurator,1:string}|\Closure|ReferenceConfigurator|ExpressionConfigurator + * @psalm-type DeprecationType = array{package: string, version: string, message?: string} + * @psalm-type DefaultsType = array{ + * public?: bool, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * } + * @psalm-type InstanceofType = array{ + * shared?: bool, + * lazy?: bool|string, + * public?: bool, + * properties?: array, + * configurator?: CallbackType, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * bind?: array, + * constructor?: string, + * } + * @psalm-type DefinitionType = array{ + * class?: string, + * file?: string, + * parent?: string, + * shared?: bool, + * synthetic?: bool, + * lazy?: bool|string, + * public?: bool, + * abstract?: bool, + * deprecated?: DeprecationType, + * factory?: CallbackType, + * configurator?: CallbackType, + * arguments?: ArgumentsType, + * properties?: array, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * decorates?: string, + * decoration_inner_name?: string, + * decoration_priority?: int, + * decoration_on_invalid?: 'exception'|'ignore'|null, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * constructor?: string, + * from_callable?: CallbackType, + * } + * @psalm-type AliasType = string|array{ + * alias: string, + * public?: bool, + * deprecated?: DeprecationType, + * } + * @psalm-type PrototypeType = array{ + * resource: string, + * namespace?: string, + * exclude?: string|list, + * parent?: string, + * shared?: bool, + * lazy?: bool|string, + * public?: bool, + * abstract?: bool, + * deprecated?: DeprecationType, + * factory?: CallbackType, + * arguments?: ArgumentsType, + * properties?: array, + * configurator?: CallbackType, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * constructor?: string, + * } + * @psalm-type StackType = array{ + * stack: list>, + * public?: bool, + * deprecated?: DeprecationType, + * } + * @psalm-type ServicesConfig = array{ + * _defaults?: DefaultsType, + * _instanceof?: InstanceofType, + * ... + * } + * @psalm-type ExtensionType = array + * @psalm-type FrameworkConfig = array{ + * secret?: scalar|null, + * http_method_override?: bool, // Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. // Default: false + * allowed_http_method_override?: list|null, + * trust_x_sendfile_type_header?: scalar|null, // Set true to enable support for xsendfile in binary file responses. // Default: "%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%" + * ide?: scalar|null, // Default: "%env(default::SYMFONY_IDE)%" + * test?: bool, + * default_locale?: scalar|null, // Default: "en" + * set_locale_from_accept_language?: bool, // Whether to use the Accept-Language HTTP header to set the Request locale (only when the "_locale" request attribute is not passed). // Default: false + * set_content_language_from_locale?: bool, // Whether to set the Content-Language HTTP header on the Response using the Request locale. // Default: false + * enabled_locales?: list, + * trusted_hosts?: list, + * trusted_proxies?: mixed, // Default: ["%env(default::SYMFONY_TRUSTED_PROXIES)%"] + * trusted_headers?: list, + * error_controller?: scalar|null, // Default: "error_controller" + * handle_all_throwables?: bool, // HttpKernel will handle all kinds of \Throwable. // Default: true + * csrf_protection?: bool|array{ + * enabled?: scalar|null, // Default: null + * stateless_token_ids?: list, + * check_header?: scalar|null, // Whether to check the CSRF token in a header in addition to a cookie when using stateless protection. // Default: false + * cookie_name?: scalar|null, // The name of the cookie to use when using stateless protection. // Default: "csrf-token" + * }, + * form?: bool|array{ // Form configuration + * enabled?: bool, // Default: true + * csrf_protection?: array{ + * enabled?: scalar|null, // Default: null + * token_id?: scalar|null, // Default: null + * field_name?: scalar|null, // Default: "_token" + * field_attr?: array, + * }, + * }, + * http_cache?: bool|array{ // HTTP cache configuration + * enabled?: bool, // Default: false + * debug?: bool, // Default: "%kernel.debug%" + * trace_level?: "none"|"short"|"full", + * trace_header?: scalar|null, + * default_ttl?: int, + * private_headers?: list, + * skip_response_headers?: list, + * allow_reload?: bool, + * allow_revalidate?: bool, + * stale_while_revalidate?: int, + * stale_if_error?: int, + * terminate_on_cache_hit?: bool, + * }, + * esi?: bool|array{ // ESI configuration + * enabled?: bool, // Default: false + * }, + * ssi?: bool|array{ // SSI configuration + * enabled?: bool, // Default: false + * }, + * fragments?: bool|array{ // Fragments configuration + * enabled?: bool, // Default: false + * hinclude_default_template?: scalar|null, // Default: null + * path?: scalar|null, // Default: "/_fragment" + * }, + * profiler?: bool|array{ // Profiler configuration + * enabled?: bool, // Default: false + * collect?: bool, // Default: true + * collect_parameter?: scalar|null, // The name of the parameter to use to enable or disable collection on a per request basis. // Default: null + * only_exceptions?: bool, // Default: false + * only_main_requests?: bool, // Default: false + * dsn?: scalar|null, // Default: "file:%kernel.cache_dir%/profiler" + * collect_serializer_data?: bool, // Enables the serializer data collector and profiler panel. // Default: false + * }, + * workflows?: bool|array{ + * enabled?: bool, // Default: false + * workflows?: array, + * definition_validators?: list, + * support_strategy?: scalar|null, + * initial_marking?: list, + * events_to_dispatch?: list|null, + * places?: list, + * }>, + * transitions: list, + * to?: list, + * weight?: int, // Default: 1 + * metadata?: list, + * }>, + * metadata?: list, + * }>, + * }, + * router?: bool|array{ // Router configuration + * enabled?: bool, // Default: false + * resource: scalar|null, + * type?: scalar|null, + * cache_dir?: scalar|null, // Deprecated: Setting the "framework.router.cache_dir.cache_dir" configuration option is deprecated. It will be removed in version 8.0. // Default: "%kernel.build_dir%" + * default_uri?: scalar|null, // The default URI used to generate URLs in a non-HTTP context. // Default: null + * http_port?: scalar|null, // Default: 80 + * https_port?: scalar|null, // Default: 443 + * strict_requirements?: scalar|null, // set to true to throw an exception when a parameter does not match the requirements set to false to disable exceptions when a parameter does not match the requirements (and return null instead) set to null to disable parameter checks against requirements 'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production // Default: true + * utf8?: bool, // Default: true + * }, + * session?: bool|array{ // Session configuration + * enabled?: bool, // Default: false + * storage_factory_id?: scalar|null, // Default: "session.storage.factory.native" + * handler_id?: scalar|null, // Defaults to using the native session handler, or to the native *file* session handler if "save_path" is not null. + * name?: scalar|null, + * cookie_lifetime?: scalar|null, + * cookie_path?: scalar|null, + * cookie_domain?: scalar|null, + * cookie_secure?: true|false|"auto", // Default: "auto" + * cookie_httponly?: bool, // Default: true + * cookie_samesite?: null|"lax"|"strict"|"none", // Default: "lax" + * use_cookies?: bool, + * gc_divisor?: scalar|null, + * gc_probability?: scalar|null, + * gc_maxlifetime?: scalar|null, + * save_path?: scalar|null, // Defaults to "%kernel.cache_dir%/sessions" if the "handler_id" option is not null. + * metadata_update_threshold?: int, // Seconds to wait between 2 session metadata updates. // Default: 0 + * sid_length?: int, // Deprecated: Setting the "framework.session.sid_length.sid_length" configuration option is deprecated. It will be removed in version 8.0. No alternative is provided as PHP 8.4 has deprecated the related option. + * sid_bits_per_character?: int, // Deprecated: Setting the "framework.session.sid_bits_per_character.sid_bits_per_character" configuration option is deprecated. It will be removed in version 8.0. No alternative is provided as PHP 8.4 has deprecated the related option. + * }, + * request?: bool|array{ // Request configuration + * enabled?: bool, // Default: false + * formats?: array>, + * }, + * assets?: bool|array{ // Assets configuration + * enabled?: bool, // Default: true + * strict_mode?: bool, // Throw an exception if an entry is missing from the manifest.json. // Default: false + * version_strategy?: scalar|null, // Default: null + * version?: scalar|null, // Default: null + * version_format?: scalar|null, // Default: "%%s?%%s" + * json_manifest_path?: scalar|null, // Default: null + * base_path?: scalar|null, // Default: "" + * base_urls?: list, + * packages?: array, + * }>, + * }, + * asset_mapper?: bool|array{ // Asset Mapper configuration + * enabled?: bool, // Default: false + * paths?: array, + * excluded_patterns?: list, + * exclude_dotfiles?: bool, // If true, any files starting with "." will be excluded from the asset mapper. // Default: true + * server?: bool, // If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default). // Default: true + * public_prefix?: scalar|null, // The public path where the assets will be written to (and served from when "server" is true). // Default: "/assets/" + * missing_import_mode?: "strict"|"warn"|"ignore", // Behavior if an asset cannot be found when imported from JavaScript or CSS files - e.g. "import './non-existent.js'". "strict" means an exception is thrown, "warn" means a warning is logged, "ignore" means the import is left as-is. // Default: "warn" + * extensions?: array, + * importmap_path?: scalar|null, // The path of the importmap.php file. // Default: "%kernel.project_dir%/importmap.php" + * importmap_polyfill?: scalar|null, // The importmap name that will be used to load the polyfill. Set to false to disable. // Default: "es-module-shims" + * importmap_script_attributes?: array, + * vendor_dir?: scalar|null, // The directory to store JavaScript vendors. // Default: "%kernel.project_dir%/assets/vendor" + * precompress?: bool|array{ // Precompress assets with Brotli, Zstandard and gzip. + * enabled?: bool, // Default: false + * formats?: list, + * extensions?: list, + * }, + * }, + * translator?: bool|array{ // Translator configuration + * enabled?: bool, // Default: false + * fallbacks?: list, + * logging?: bool, // Default: false + * formatter?: scalar|null, // Default: "translator.formatter.default" + * cache_dir?: scalar|null, // Default: "%kernel.cache_dir%/translations" + * default_path?: scalar|null, // The default path used to load translations. // Default: "%kernel.project_dir%/translations" + * paths?: list, + * pseudo_localization?: bool|array{ + * enabled?: bool, // Default: false + * accents?: bool, // Default: true + * expansion_factor?: float, // Default: 1.0 + * brackets?: bool, // Default: true + * parse_html?: bool, // Default: false + * localizable_html_attributes?: list, + * }, + * providers?: array, + * locales?: list, + * }>, + * globals?: array, + * domain?: string, + * }>, + * }, + * validation?: bool|array{ // Validation configuration + * enabled?: bool, // Default: true + * cache?: scalar|null, // Deprecated: Setting the "framework.validation.cache.cache" configuration option is deprecated. It will be removed in version 8.0. + * enable_attributes?: bool, // Default: true + * static_method?: list, + * translation_domain?: scalar|null, // Default: "validators" + * email_validation_mode?: "html5"|"html5-allow-no-tld"|"strict"|"loose", // Default: "html5" + * mapping?: array{ + * paths?: list, + * }, + * not_compromised_password?: bool|array{ + * enabled?: bool, // When disabled, compromised passwords will be accepted as valid. // Default: true + * endpoint?: scalar|null, // API endpoint for the NotCompromisedPassword Validator. // Default: null + * }, + * disable_translation?: bool, // Default: false + * auto_mapping?: array, + * }>, + * }, + * annotations?: bool|array{ + * enabled?: bool, // Default: false + * }, + * serializer?: bool|array{ // Serializer configuration + * enabled?: bool, // Default: true + * enable_attributes?: bool, // Default: true + * name_converter?: scalar|null, + * circular_reference_handler?: scalar|null, + * max_depth_handler?: scalar|null, + * mapping?: array{ + * paths?: list, + * }, + * default_context?: list, + * named_serializers?: array, + * include_built_in_normalizers?: bool, // Whether to include the built-in normalizers // Default: true + * include_built_in_encoders?: bool, // Whether to include the built-in encoders // Default: true + * }>, + * }, + * property_access?: bool|array{ // Property access configuration + * enabled?: bool, // Default: true + * magic_call?: bool, // Default: false + * magic_get?: bool, // Default: true + * magic_set?: bool, // Default: true + * throw_exception_on_invalid_index?: bool, // Default: false + * throw_exception_on_invalid_property_path?: bool, // Default: true + * }, + * type_info?: bool|array{ // Type info configuration + * enabled?: bool, // Default: true + * aliases?: array, + * }, + * property_info?: bool|array{ // Property info configuration + * enabled?: bool, // Default: true + * with_constructor_extractor?: bool, // Registers the constructor extractor. + * }, + * cache?: array{ // Cache configuration + * prefix_seed?: scalar|null, // Used to namespace cache keys when using several apps with the same shared backend. // Default: "_%kernel.project_dir%.%kernel.container_class%" + * app?: scalar|null, // App related cache pools configuration. // Default: "cache.adapter.filesystem" + * system?: scalar|null, // System related cache pools configuration. // Default: "cache.adapter.system" + * directory?: scalar|null, // Default: "%kernel.share_dir%/pools/app" + * default_psr6_provider?: scalar|null, + * default_redis_provider?: scalar|null, // Default: "redis://localhost" + * default_valkey_provider?: scalar|null, // Default: "valkey://localhost" + * default_memcached_provider?: scalar|null, // Default: "memcached://localhost" + * default_doctrine_dbal_provider?: scalar|null, // Default: "database_connection" + * default_pdo_provider?: scalar|null, // Default: null + * pools?: array, + * tags?: scalar|null, // Default: null + * public?: bool, // Default: false + * default_lifetime?: scalar|null, // Default lifetime of the pool. + * provider?: scalar|null, // Overwrite the setting from the default provider for this adapter. + * early_expiration_message_bus?: scalar|null, + * clearer?: scalar|null, + * }>, + * }, + * php_errors?: array{ // PHP errors handling configuration + * log?: mixed, // Use the application logger instead of the PHP logger for logging PHP errors. // Default: true + * throw?: bool, // Throw PHP errors as \ErrorException instances. // Default: true + * }, + * exceptions?: array, + * web_link?: bool|array{ // Web links configuration + * enabled?: bool, // Default: false + * }, + * lock?: bool|string|array{ // Lock configuration + * enabled?: bool, // Default: true + * resources?: array>, + * }, + * semaphore?: bool|string|array{ // Semaphore configuration + * enabled?: bool, // Default: false + * resources?: array, + * }, + * messenger?: bool|array{ // Messenger configuration + * enabled?: bool, // Default: true + * routing?: array, + * }>, + * serializer?: array{ + * default_serializer?: scalar|null, // Service id to use as the default serializer for the transports. // Default: "messenger.transport.native_php_serializer" + * symfony_serializer?: array{ + * format?: scalar|null, // Serialization format for the messenger.transport.symfony_serializer service (which is not the serializer used by default). // Default: "json" + * context?: array, + * }, + * }, + * transports?: array, + * failure_transport?: scalar|null, // Transport name to send failed messages to (after all retries have failed). // Default: null + * retry_strategy?: string|array{ + * service?: scalar|null, // Service id to override the retry strategy entirely. // Default: null + * max_retries?: int, // Default: 3 + * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries)). // Default: 2 + * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float, // Randomness to apply to the delay (between 0 and 1). // Default: 0.1 + * }, + * rate_limiter?: scalar|null, // Rate limiter name to use when processing messages. // Default: null + * }>, + * failure_transport?: scalar|null, // Transport name to send failed messages to (after all retries have failed). // Default: null + * stop_worker_on_signals?: list, + * default_bus?: scalar|null, // Default: null + * buses?: array, + * }>, + * }>, + * }, + * scheduler?: bool|array{ // Scheduler configuration + * enabled?: bool, // Default: false + * }, + * disallow_search_engine_index?: bool, // Enabled by default when debug is enabled. // Default: true + * http_client?: bool|array{ // HTTP Client configuration + * enabled?: bool, // Default: false + * max_host_connections?: int, // The maximum number of connections to a single host. + * default_options?: array{ + * headers?: array, + * vars?: list, + * max_redirects?: int, // The maximum number of redirects to follow. + * http_version?: scalar|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. + * resolve?: array, + * proxy?: scalar|null, // The URL of the proxy to pass requests through or null for automatic detection. + * no_proxy?: scalar|null, // A comma separated list of hosts that do not require a proxy to be reached. + * timeout?: float, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. + * max_duration?: float, // The maximum execution time for the request+response as a whole. + * bindto?: scalar|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. + * verify_peer?: bool, // Indicates if the peer should be verified in a TLS context. + * verify_host?: bool, // Indicates if the host should exist as a certificate common name. + * cafile?: scalar|null, // A certificate authority file. + * capath?: scalar|null, // A directory that contains multiple certificate authority files. + * local_cert?: scalar|null, // A PEM formatted certificate file. + * local_pk?: scalar|null, // A private key file. + * passphrase?: scalar|null, // The passphrase used to encrypt the "local_pk" file. + * ciphers?: scalar|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...) + * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). + * sha1?: mixed, + * pin-sha256?: mixed, + * md5?: mixed, + * }, + * crypto_method?: scalar|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. + * extra?: list, + * rate_limiter?: scalar|null, // Rate limiter name to use for throttling requests. // Default: null + * caching?: bool|array{ // Caching configuration. + * enabled?: bool, // Default: false + * cache_pool?: string, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" + * shared?: bool, // Indicates whether the cache is shared (public) or private. // Default: true + * max_ttl?: int, // The maximum TTL (in seconds) allowed for cached responses. Null means no cap. // Default: null + * }, + * retry_failed?: bool|array{ + * enabled?: bool, // Default: false + * retry_strategy?: scalar|null, // service id to override the retry strategy. // Default: null + * http_codes?: array, + * }>, + * max_retries?: int, // Default: 3 + * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 + * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 + * }, + * }, + * mock_response_factory?: scalar|null, // The id of the service that should generate mock responses. It should be either an invokable or an iterable. + * scoped_clients?: array, + * headers?: array, + * max_redirects?: int, // The maximum number of redirects to follow. + * http_version?: scalar|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. + * resolve?: array, + * proxy?: scalar|null, // The URL of the proxy to pass requests through or null for automatic detection. + * no_proxy?: scalar|null, // A comma separated list of hosts that do not require a proxy to be reached. + * timeout?: float, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. + * max_duration?: float, // The maximum execution time for the request+response as a whole. + * bindto?: scalar|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. + * verify_peer?: bool, // Indicates if the peer should be verified in a TLS context. + * verify_host?: bool, // Indicates if the host should exist as a certificate common name. + * cafile?: scalar|null, // A certificate authority file. + * capath?: scalar|null, // A directory that contains multiple certificate authority files. + * local_cert?: scalar|null, // A PEM formatted certificate file. + * local_pk?: scalar|null, // A private key file. + * passphrase?: scalar|null, // The passphrase used to encrypt the "local_pk" file. + * ciphers?: scalar|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...). + * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). + * sha1?: mixed, + * pin-sha256?: mixed, + * md5?: mixed, + * }, + * crypto_method?: scalar|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. + * extra?: list, + * rate_limiter?: scalar|null, // Rate limiter name to use for throttling requests. // Default: null + * caching?: bool|array{ // Caching configuration. + * enabled?: bool, // Default: false + * cache_pool?: string, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" + * shared?: bool, // Indicates whether the cache is shared (public) or private. // Default: true + * max_ttl?: int, // The maximum TTL (in seconds) allowed for cached responses. Null means no cap. // Default: null + * }, + * retry_failed?: bool|array{ + * enabled?: bool, // Default: false + * retry_strategy?: scalar|null, // service id to override the retry strategy. // Default: null + * http_codes?: array, + * }>, + * max_retries?: int, // Default: 3 + * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 + * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 + * }, + * }>, + * }, + * mailer?: bool|array{ // Mailer configuration + * enabled?: bool, // Default: false + * message_bus?: scalar|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null + * dsn?: scalar|null, // Default: null + * transports?: array, + * envelope?: array{ // Mailer Envelope configuration + * sender?: scalar|null, + * recipients?: list, + * allowed_recipients?: list, + * }, + * headers?: array, + * dkim_signer?: bool|array{ // DKIM signer configuration + * enabled?: bool, // Default: false + * key?: scalar|null, // Key content, or path to key (in PEM format with the `file://` prefix) // Default: "" + * domain?: scalar|null, // Default: "" + * select?: scalar|null, // Default: "" + * passphrase?: scalar|null, // The private key passphrase // Default: "" + * options?: array, + * }, + * smime_signer?: bool|array{ // S/MIME signer configuration + * enabled?: bool, // Default: false + * key?: scalar|null, // Path to key (in PEM format) // Default: "" + * certificate?: scalar|null, // Path to certificate (in PEM format without the `file://` prefix) // Default: "" + * passphrase?: scalar|null, // The private key passphrase // Default: null + * extra_certificates?: scalar|null, // Default: null + * sign_options?: int, // Default: null + * }, + * smime_encrypter?: bool|array{ // S/MIME encrypter configuration + * enabled?: bool, // Default: false + * repository?: scalar|null, // S/MIME certificate repository service. This service shall implement the `Symfony\Component\Mailer\EventListener\SmimeCertificateRepositoryInterface`. // Default: "" + * cipher?: int, // A set of algorithms used to encrypt the message // Default: null + * }, + * }, + * secrets?: bool|array{ + * enabled?: bool, // Default: true + * vault_directory?: scalar|null, // Default: "%kernel.project_dir%/config/secrets/%kernel.runtime_environment%" + * local_dotenv_file?: scalar|null, // Default: "%kernel.project_dir%/.env.%kernel.runtime_environment%.local" + * decryption_env_var?: scalar|null, // Default: "base64:default::SYMFONY_DECRYPTION_SECRET" + * }, + * notifier?: bool|array{ // Notifier configuration + * enabled?: bool, // Default: false + * message_bus?: scalar|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null + * chatter_transports?: array, + * texter_transports?: array, + * notification_on_failed_messages?: bool, // Default: false + * channel_policy?: array>, + * admin_recipients?: list, + * }, + * rate_limiter?: bool|array{ // Rate limiter configuration + * enabled?: bool, // Default: false + * limiters?: array, + * limit?: int, // The maximum allowed hits in a fixed interval or burst. + * interval?: scalar|null, // Configures the fixed interval if "policy" is set to "fixed_window" or "sliding_window". The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). + * rate?: array{ // Configures the fill rate if "policy" is set to "token_bucket". + * interval?: scalar|null, // Configures the rate interval. The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). + * amount?: int, // Amount of tokens to add each interval. // Default: 1 + * }, + * }>, + * }, + * uid?: bool|array{ // Uid configuration + * enabled?: bool, // Default: false + * default_uuid_version?: 7|6|4|1, // Default: 7 + * name_based_uuid_version?: 5|3, // Default: 5 + * name_based_uuid_namespace?: scalar|null, + * time_based_uuid_version?: 7|6|1, // Default: 7 + * time_based_uuid_node?: scalar|null, + * }, + * html_sanitizer?: bool|array{ // HtmlSanitizer configuration + * enabled?: bool, // Default: false + * sanitizers?: array, + * block_elements?: list, + * drop_elements?: list, + * allow_attributes?: array, + * drop_attributes?: array, + * force_attributes?: array>, + * force_https_urls?: bool, // Transforms URLs using the HTTP scheme to use the HTTPS scheme instead. // Default: false + * allowed_link_schemes?: list, + * allowed_link_hosts?: list|null, + * allow_relative_links?: bool, // Allows relative URLs to be used in links href attributes. // Default: false + * allowed_media_schemes?: list, + * allowed_media_hosts?: list|null, + * allow_relative_medias?: bool, // Allows relative URLs to be used in media source attributes (img, audio, video, ...). // Default: false + * with_attribute_sanitizers?: list, + * without_attribute_sanitizers?: list, + * max_input_length?: int, // The maximum length allowed for the sanitized input. // Default: 0 + * }>, + * }, + * webhook?: bool|array{ // Webhook configuration + * enabled?: bool, // Default: true + * message_bus?: scalar|null, // The message bus to use. // Default: "messenger.default_bus" + * routing?: array, + * }, + * remote-event?: bool|array{ // RemoteEvent configuration + * enabled?: bool, // Default: true + * }, + * json_streamer?: bool|array{ // JSON streamer configuration + * enabled?: bool, // Default: false + * }, + * } + * @psalm-type MonologConfig = array{ + * use_microseconds?: scalar|null, // Default: true + * channels?: list, + * handlers?: array, + * excluded_http_codes?: list, + * }>, + * accepted_levels?: list, + * min_level?: scalar|null, // Default: "DEBUG" + * max_level?: scalar|null, // Default: "EMERGENCY" + * buffer_size?: scalar|null, // Default: 0 + * flush_on_overflow?: bool, // Default: false + * handler?: scalar|null, + * url?: scalar|null, + * exchange?: scalar|null, + * exchange_name?: scalar|null, // Default: "log" + * room?: scalar|null, + * message_format?: scalar|null, // Default: "text" + * api_version?: scalar|null, // Default: null + * channel?: scalar|null, // Default: null + * bot_name?: scalar|null, // Default: "Monolog" + * use_attachment?: scalar|null, // Default: true + * use_short_attachment?: scalar|null, // Default: false + * include_extra?: scalar|null, // Default: false + * icon_emoji?: scalar|null, // Default: null + * webhook_url?: scalar|null, + * exclude_fields?: list, + * team?: scalar|null, + * notify?: scalar|null, // Default: false + * nickname?: scalar|null, // Default: "Monolog" + * token?: scalar|null, + * region?: scalar|null, + * source?: scalar|null, + * use_ssl?: bool, // Default: true + * user?: mixed, + * title?: scalar|null, // Default: null + * host?: scalar|null, // Default: null + * port?: scalar|null, // Default: 514 + * config?: list, + * members?: list, + * connection_string?: scalar|null, + * timeout?: scalar|null, + * time?: scalar|null, // Default: 60 + * deduplication_level?: scalar|null, // Default: 400 + * store?: scalar|null, // Default: null + * connection_timeout?: scalar|null, + * persistent?: bool, + * dsn?: scalar|null, + * hub_id?: scalar|null, // Default: null + * client_id?: scalar|null, // Default: null + * auto_log_stacks?: scalar|null, // Default: false + * release?: scalar|null, // Default: null + * environment?: scalar|null, // Default: null + * message_type?: scalar|null, // Default: 0 + * parse_mode?: scalar|null, // Default: null + * disable_webpage_preview?: bool|null, // Default: null + * disable_notification?: bool|null, // Default: null + * split_long_messages?: bool, // Default: false + * delay_between_messages?: bool, // Default: false + * topic?: int, // Default: null + * factor?: int, // Default: 1 + * tags?: list, + * console_formater_options?: mixed, // Deprecated: "monolog.handlers..console_formater_options.console_formater_options" is deprecated, use "monolog.handlers..console_formater_options.console_formatter_options" instead. + * console_formatter_options?: mixed, // Default: [] + * formatter?: scalar|null, + * nested?: bool, // Default: false + * publisher?: string|array{ + * id?: scalar|null, + * hostname?: scalar|null, + * port?: scalar|null, // Default: 12201 + * chunk_size?: scalar|null, // Default: 1420 + * encoder?: "json"|"compressed_json", + * }, + * mongo?: string|array{ + * id?: scalar|null, + * host?: scalar|null, + * port?: scalar|null, // Default: 27017 + * user?: scalar|null, + * pass?: scalar|null, + * database?: scalar|null, // Default: "monolog" + * collection?: scalar|null, // Default: "logs" + * }, + * mongodb?: string|array{ + * id?: scalar|null, // ID of a MongoDB\Client service + * uri?: scalar|null, + * username?: scalar|null, + * password?: scalar|null, + * database?: scalar|null, // Default: "monolog" + * collection?: scalar|null, // Default: "logs" + * }, + * elasticsearch?: string|array{ + * id?: scalar|null, + * hosts?: list, + * host?: scalar|null, + * port?: scalar|null, // Default: 9200 + * transport?: scalar|null, // Default: "Http" + * user?: scalar|null, // Default: null + * password?: scalar|null, // Default: null + * }, + * index?: scalar|null, // Default: "monolog" + * document_type?: scalar|null, // Default: "logs" + * ignore_error?: scalar|null, // Default: false + * redis?: string|array{ + * id?: scalar|null, + * host?: scalar|null, + * password?: scalar|null, // Default: null + * port?: scalar|null, // Default: 6379 + * database?: scalar|null, // Default: 0 + * key_name?: scalar|null, // Default: "monolog_redis" + * }, + * predis?: string|array{ + * id?: scalar|null, + * host?: scalar|null, + * }, + * from_email?: scalar|null, + * to_email?: list, + * subject?: scalar|null, + * content_type?: scalar|null, // Default: null + * headers?: list, + * mailer?: scalar|null, // Default: null + * email_prototype?: string|array{ + * id: scalar|null, + * method?: scalar|null, // Default: null + * }, + * lazy?: bool, // Default: true + * verbosity_levels?: array{ + * VERBOSITY_QUIET?: scalar|null, // Default: "ERROR" + * VERBOSITY_NORMAL?: scalar|null, // Default: "WARNING" + * VERBOSITY_VERBOSE?: scalar|null, // Default: "NOTICE" + * VERBOSITY_VERY_VERBOSE?: scalar|null, // Default: "INFO" + * VERBOSITY_DEBUG?: scalar|null, // Default: "DEBUG" + * }, + * channels?: string|array{ + * type?: scalar|null, + * elements?: list, + * }, + * }>, + * } + * @psalm-type SecurityConfig = array{ + * access_denied_url?: scalar|null, // Default: null + * session_fixation_strategy?: "none"|"migrate"|"invalidate", // Default: "migrate" + * hide_user_not_found?: bool, // Deprecated: The "hide_user_not_found" option is deprecated and will be removed in 8.0. Use the "expose_security_errors" option instead. + * expose_security_errors?: \Symfony\Component\Security\Http\Authentication\ExposeSecurityLevel::None|\Symfony\Component\Security\Http\Authentication\ExposeSecurityLevel::AccountStatus|\Symfony\Component\Security\Http\Authentication\ExposeSecurityLevel::All, // Default: "none" + * erase_credentials?: bool, // Default: true + * access_decision_manager?: array{ + * strategy?: "affirmative"|"consensus"|"unanimous"|"priority", + * service?: scalar|null, + * strategy_service?: scalar|null, + * allow_if_all_abstain?: bool, // Default: false + * allow_if_equal_granted_denied?: bool, // Default: true + * }, + * password_hashers?: array, + * hash_algorithm?: scalar|null, // Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms. // Default: "sha512" + * key_length?: scalar|null, // Default: 40 + * ignore_case?: bool, // Default: false + * encode_as_base64?: bool, // Default: true + * iterations?: scalar|null, // Default: 5000 + * cost?: int, // Default: null + * memory_cost?: scalar|null, // Default: null + * time_cost?: scalar|null, // Default: null + * id?: scalar|null, + * }>, + * providers?: array, + * }, + * memory?: array{ + * users?: array, + * }>, + * }, + * ldap?: array{ + * service: scalar|null, + * base_dn: scalar|null, + * search_dn?: scalar|null, // Default: null + * search_password?: scalar|null, // Default: null + * extra_fields?: list, + * default_roles?: list, + * role_fetcher?: scalar|null, // Default: null + * uid_key?: scalar|null, // Default: "sAMAccountName" + * filter?: scalar|null, // Default: "({uid_key}={user_identifier})" + * password_attribute?: scalar|null, // Default: null + * }, + * }>, + * firewalls: array, + * security?: bool, // Default: true + * user_checker?: scalar|null, // The UserChecker to use when authenticating users in this firewall. // Default: "security.user_checker" + * request_matcher?: scalar|null, + * access_denied_url?: scalar|null, + * access_denied_handler?: scalar|null, + * entry_point?: scalar|null, // An enabled authenticator name or a service id that implements "Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface". + * provider?: scalar|null, + * stateless?: bool, // Default: false + * lazy?: bool, // Default: false + * context?: scalar|null, + * logout?: array{ + * enable_csrf?: bool|null, // Default: null + * csrf_token_id?: scalar|null, // Default: "logout" + * csrf_parameter?: scalar|null, // Default: "_csrf_token" + * csrf_token_manager?: scalar|null, + * path?: scalar|null, // Default: "/logout" + * target?: scalar|null, // Default: "/" + * invalidate_session?: bool, // Default: true + * clear_site_data?: list<"*"|"cache"|"cookies"|"storage"|"executionContexts">, + * delete_cookies?: array, + * }, + * switch_user?: array{ + * provider?: scalar|null, + * parameter?: scalar|null, // Default: "_switch_user" + * role?: scalar|null, // Default: "ROLE_ALLOWED_TO_SWITCH" + * target_route?: scalar|null, // Default: null + * }, + * required_badges?: list, + * custom_authenticators?: list, + * login_throttling?: array{ + * limiter?: scalar|null, // A service id implementing "Symfony\Component\HttpFoundation\RateLimiter\RequestRateLimiterInterface". + * max_attempts?: int, // Default: 5 + * interval?: scalar|null, // Default: "1 minute" + * lock_factory?: scalar|null, // The service ID of the lock factory used by the login rate limiter (or null to disable locking). // Default: null + * cache_pool?: string, // The cache pool to use for storing the limiter state // Default: "cache.rate_limiter" + * storage_service?: string, // The service ID of a custom storage implementation, this precedes any configured "cache_pool" // Default: null + * }, + * x509?: array{ + * provider?: scalar|null, + * user?: scalar|null, // Default: "SSL_CLIENT_S_DN_Email" + * credentials?: scalar|null, // Default: "SSL_CLIENT_S_DN" + * user_identifier?: scalar|null, // Default: "emailAddress" + * }, + * remote_user?: array{ + * provider?: scalar|null, + * user?: scalar|null, // Default: "REMOTE_USER" + * }, + * login_link?: array{ + * check_route: scalar|null, // Route that will validate the login link - e.g. "app_login_link_verify". + * check_post_only?: scalar|null, // If true, only HTTP POST requests to "check_route" will be handled by the authenticator. // Default: false + * signature_properties: list, + * lifetime?: int, // The lifetime of the login link in seconds. // Default: 600 + * max_uses?: int, // Max number of times a login link can be used - null means unlimited within lifetime. // Default: null + * used_link_cache?: scalar|null, // Cache service id used to expired links of max_uses is set. + * success_handler?: scalar|null, // A service id that implements Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface. + * failure_handler?: scalar|null, // A service id that implements Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface. + * provider?: scalar|null, // The user provider to load users from. + * secret?: scalar|null, // Default: "%kernel.secret%" + * always_use_default_target_path?: bool, // Default: false + * default_target_path?: scalar|null, // Default: "/" + * login_path?: scalar|null, // Default: "/login" + * target_path_parameter?: scalar|null, // Default: "_target_path" + * use_referer?: bool, // Default: false + * failure_path?: scalar|null, // Default: null + * failure_forward?: bool, // Default: false + * failure_path_parameter?: scalar|null, // Default: "_failure_path" + * }, + * form_login?: array{ + * provider?: scalar|null, + * remember_me?: bool, // Default: true + * success_handler?: scalar|null, + * failure_handler?: scalar|null, + * check_path?: scalar|null, // Default: "/login_check" + * use_forward?: bool, // Default: false + * login_path?: scalar|null, // Default: "/login" + * username_parameter?: scalar|null, // Default: "_username" + * password_parameter?: scalar|null, // Default: "_password" + * csrf_parameter?: scalar|null, // Default: "_csrf_token" + * csrf_token_id?: scalar|null, // Default: "authenticate" + * enable_csrf?: bool, // Default: false + * post_only?: bool, // Default: true + * form_only?: bool, // Default: false + * always_use_default_target_path?: bool, // Default: false + * default_target_path?: scalar|null, // Default: "/" + * target_path_parameter?: scalar|null, // Default: "_target_path" + * use_referer?: bool, // Default: false + * failure_path?: scalar|null, // Default: null + * failure_forward?: bool, // Default: false + * failure_path_parameter?: scalar|null, // Default: "_failure_path" + * }, + * form_login_ldap?: array{ + * provider?: scalar|null, + * remember_me?: bool, // Default: true + * success_handler?: scalar|null, + * failure_handler?: scalar|null, + * check_path?: scalar|null, // Default: "/login_check" + * use_forward?: bool, // Default: false + * login_path?: scalar|null, // Default: "/login" + * username_parameter?: scalar|null, // Default: "_username" + * password_parameter?: scalar|null, // Default: "_password" + * csrf_parameter?: scalar|null, // Default: "_csrf_token" + * csrf_token_id?: scalar|null, // Default: "authenticate" + * enable_csrf?: bool, // Default: false + * post_only?: bool, // Default: true + * form_only?: bool, // Default: false + * always_use_default_target_path?: bool, // Default: false + * default_target_path?: scalar|null, // Default: "/" + * target_path_parameter?: scalar|null, // Default: "_target_path" + * use_referer?: bool, // Default: false + * failure_path?: scalar|null, // Default: null + * failure_forward?: bool, // Default: false + * failure_path_parameter?: scalar|null, // Default: "_failure_path" + * service?: scalar|null, // Default: "ldap" + * dn_string?: scalar|null, // Default: "{user_identifier}" + * query_string?: scalar|null, + * search_dn?: scalar|null, // Default: "" + * search_password?: scalar|null, // Default: "" + * }, + * json_login?: array{ + * provider?: scalar|null, + * remember_me?: bool, // Default: true + * success_handler?: scalar|null, + * failure_handler?: scalar|null, + * check_path?: scalar|null, // Default: "/login_check" + * use_forward?: bool, // Default: false + * login_path?: scalar|null, // Default: "/login" + * username_path?: scalar|null, // Default: "username" + * password_path?: scalar|null, // Default: "password" + * }, + * json_login_ldap?: array{ + * provider?: scalar|null, + * remember_me?: bool, // Default: true + * success_handler?: scalar|null, + * failure_handler?: scalar|null, + * check_path?: scalar|null, // Default: "/login_check" + * use_forward?: bool, // Default: false + * login_path?: scalar|null, // Default: "/login" + * username_path?: scalar|null, // Default: "username" + * password_path?: scalar|null, // Default: "password" + * service?: scalar|null, // Default: "ldap" + * dn_string?: scalar|null, // Default: "{user_identifier}" + * query_string?: scalar|null, + * search_dn?: scalar|null, // Default: "" + * search_password?: scalar|null, // Default: "" + * }, + * access_token?: array{ + * provider?: scalar|null, + * remember_me?: bool, // Default: true + * success_handler?: scalar|null, + * failure_handler?: scalar|null, + * realm?: scalar|null, // Default: null + * token_extractors?: list, + * token_handler: string|array{ + * id?: scalar|null, + * oidc_user_info?: string|array{ + * base_uri: scalar|null, // Base URI of the userinfo endpoint on the OIDC server, or the OIDC server URI to use the discovery (require "discovery" to be configured). + * discovery?: array{ // Enable the OIDC discovery. + * cache?: array{ + * id: scalar|null, // Cache service id to use to cache the OIDC discovery configuration. + * }, + * }, + * claim?: scalar|null, // Claim which contains the user identifier (e.g. sub, email, etc.). // Default: "sub" + * client?: scalar|null, // HttpClient service id to use to call the OIDC server. + * }, + * oidc?: array{ + * discovery?: array{ // Enable the OIDC discovery. + * base_uri: list, + * cache?: array{ + * id: scalar|null, // Cache service id to use to cache the OIDC discovery configuration. + * }, + * }, + * claim?: scalar|null, // Claim which contains the user identifier (e.g.: sub, email..). // Default: "sub" + * audience: scalar|null, // Audience set in the token, for validation purpose. + * issuers: list, + * algorithm?: array, + * algorithms: list, + * key?: scalar|null, // Deprecated: The "key" option is deprecated and will be removed in 8.0. Use the "keyset" option instead. // JSON-encoded JWK used to sign the token (must contain a "kty" key). + * keyset?: scalar|null, // JSON-encoded JWKSet used to sign the token (must contain a list of valid public keys). + * encryption?: bool|array{ + * enabled?: bool, // Default: false + * enforce?: bool, // When enabled, the token shall be encrypted. // Default: false + * algorithms: list, + * keyset: scalar|null, // JSON-encoded JWKSet used to decrypt the token (must contain a list of valid private keys). + * }, + * }, + * cas?: array{ + * validation_url: scalar|null, // CAS server validation URL + * prefix?: scalar|null, // CAS prefix // Default: "cas" + * http_client?: scalar|null, // HTTP Client service // Default: null + * }, + * oauth2?: scalar|null, + * }, + * }, + * http_basic?: array{ + * provider?: scalar|null, + * realm?: scalar|null, // Default: "Secured Area" + * }, + * http_basic_ldap?: array{ + * provider?: scalar|null, + * realm?: scalar|null, // Default: "Secured Area" + * service?: scalar|null, // Default: "ldap" + * dn_string?: scalar|null, // Default: "{user_identifier}" + * query_string?: scalar|null, + * search_dn?: scalar|null, // Default: "" + * search_password?: scalar|null, // Default: "" + * }, + * remember_me?: array{ + * secret?: scalar|null, // Default: "%kernel.secret%" + * service?: scalar|null, + * user_providers?: list, + * catch_exceptions?: bool, // Default: true + * signature_properties?: list, + * token_provider?: string|array{ + * service?: scalar|null, // The service ID of a custom remember-me token provider. + * doctrine?: bool|array{ + * enabled?: bool, // Default: false + * connection?: scalar|null, // Default: null + * }, + * }, + * token_verifier?: scalar|null, // The service ID of a custom rememberme token verifier. + * name?: scalar|null, // Default: "REMEMBERME" + * lifetime?: int, // Default: 31536000 + * path?: scalar|null, // Default: "/" + * domain?: scalar|null, // Default: null + * secure?: true|false|"auto", // Default: null + * httponly?: bool, // Default: true + * samesite?: null|"lax"|"strict"|"none", // Default: "lax" + * always_remember_me?: bool, // Default: false + * remember_me_parameter?: scalar|null, // Default: "_remember_me" + * }, + * }>, + * access_control?: list, + * attributes?: array, + * route?: scalar|null, // Default: null + * methods?: list, + * allow_if?: scalar|null, // Default: null + * roles?: list, + * }>, + * role_hierarchy?: array>, + * } + * @psalm-type TwigConfig = array{ + * form_themes?: list, + * globals?: array, + * autoescape_service?: scalar|null, // Default: null + * autoescape_service_method?: scalar|null, // Default: null + * base_template_class?: scalar|null, // Deprecated: The child node "base_template_class" at path "twig.base_template_class" is deprecated. + * cache?: scalar|null, // Default: true + * charset?: scalar|null, // Default: "%kernel.charset%" + * debug?: bool, // Default: "%kernel.debug%" + * strict_variables?: bool, // Default: "%kernel.debug%" + * auto_reload?: scalar|null, + * optimizations?: int, + * default_path?: scalar|null, // The default path used to load templates. // Default: "%kernel.project_dir%/templates" + * file_name_pattern?: list, + * paths?: array, + * date?: array{ // The default format options used by the date filter. + * format?: scalar|null, // Default: "F j, Y H:i" + * interval_format?: scalar|null, // Default: "%d days" + * timezone?: scalar|null, // The timezone used when formatting dates, when set to null, the timezone returned by date_default_timezone_get() is used. // Default: null + * }, + * number_format?: array{ // The default format options for the number_format filter. + * decimals?: int, // Default: 0 + * decimal_point?: scalar|null, // Default: "." + * thousands_separator?: scalar|null, // Default: "," + * }, + * mailer?: array{ + * html_to_text_converter?: scalar|null, // A service implementing the "Symfony\Component\Mime\HtmlToTextConverter\HtmlToTextConverterInterface". // Default: null + * }, + * } + * @psalm-type WebProfilerConfig = array{ + * toolbar?: bool|array{ // Profiler toolbar configuration + * enabled?: bool, // Default: false + * ajax_replace?: bool, // Replace toolbar on AJAX requests // Default: false + * }, + * intercept_redirects?: bool, // Default: false + * excluded_ajax_paths?: scalar|null, // Default: "^/((index|app(_[\\w]+)?)\\.php/)?_wdt" + * } + * @psalm-type MakerConfig = array{ + * root_namespace?: scalar|null, // Default: "App" + * generate_final_classes?: bool, // Default: true + * generate_final_entities?: bool, // Default: false + * } + * @psalm-type ConfigType = array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * monolog?: MonologConfig, + * security?: SecurityConfig, + * twig?: TwigConfig, + * "when@dev"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * monolog?: MonologConfig, + * security?: SecurityConfig, + * twig?: TwigConfig, + * web_profiler?: WebProfilerConfig, + * maker?: MakerConfig, + * }, + * "when@prod"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * monolog?: MonologConfig, + * security?: SecurityConfig, + * twig?: TwigConfig, + * }, + * "when@test"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * monolog?: MonologConfig, + * security?: SecurityConfig, + * twig?: TwigConfig, + * web_profiler?: WebProfilerConfig, + * }, + * "when@testsecure"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * monolog?: MonologConfig, + * security?: SecurityConfig, + * twig?: TwigConfig, + * }, + * ..., + * }> + * } + */ +final class App +{ + /** + * @param ConfigType $config + * + * @psalm-return ConfigType + */ + public static function config(array $config): array + { + return AppReference::config($config); + } +} + +namespace Symfony\Component\Routing\Loader\Configurator; + +/** + * This class provides array-shapes for configuring the routes of an application. + * + * Example: + * + * ```php + * // config/routes.php + * namespace Symfony\Component\Routing\Loader\Configurator; + * + * return Routes::config([ + * 'controllers' => [ + * 'resource' => 'routing.controllers', + * ], + * ]); + * ``` + * + * @psalm-type RouteConfig = array{ + * path: string|array, + * controller?: string, + * methods?: string|list, + * requirements?: array, + * defaults?: array, + * options?: array, + * host?: string|array, + * schemes?: string|list, + * condition?: string, + * locale?: string, + * format?: string, + * utf8?: bool, + * stateless?: bool, + * } + * @psalm-type ImportConfig = array{ + * resource: string, + * type?: string, + * exclude?: string|list, + * prefix?: string|array, + * name_prefix?: string, + * trailing_slash_on_root?: bool, + * controller?: string, + * methods?: string|list, + * requirements?: array, + * defaults?: array, + * options?: array, + * host?: string|array, + * schemes?: string|list, + * condition?: string, + * locale?: string, + * format?: string, + * utf8?: bool, + * stateless?: bool, + * } + * @psalm-type AliasConfig = array{ + * alias: string, + * deprecated?: array{package:string, version:string, message?:string}, + * } + * @psalm-type RoutesConfig = array{ + * "when@dev"?: array, + * "when@prod"?: array, + * "when@test"?: array, + * "when@testsecure"?: array, + * ... + * } + */ +final class Routes +{ + /** + * @param RoutesConfig $config + * + * @psalm-return RoutesConfig + */ + public static function config(array $config): array + { + return $config; + } +} diff --git a/src/Event/BuildEvent.php b/src/Event/BuildEvent.php index 3240687..5bd2994 100644 --- a/src/Event/BuildEvent.php +++ b/src/Event/BuildEvent.php @@ -5,7 +5,7 @@ use App\DTO\RepositoryInterface; use Symfony\Contracts\EventDispatcher\Event; -final class BuildEvent extends Event +class BuildEvent extends Event { public const string NAME = 'satis_build'; diff --git a/src/Service/SatisManager.php b/src/Service/SatisManager.php index fa19059..d47bf7a 100644 --- a/src/Service/SatisManager.php +++ b/src/Service/SatisManager.php @@ -11,7 +11,7 @@ use Symfony\Component\Process\Exception\RuntimeException; #[AsEventListener(event: BuildEvent::class, method: 'onBuild', priority: 100)] -final class SatisManager +class SatisManager { protected string $satisFilename; @@ -80,6 +80,9 @@ public function onBuild(BuildEvent $event): void $event->setStatus($status); } + /** + * @throws \JsonException + */ protected function getCommandLine(?string $repositoryName = null, array $options = [], array $extraArgs = []): array { $configuration = $this->manager->getConfig(); @@ -99,7 +102,7 @@ protected function getCommandLine(?string $repositoryName = null, array $options $satisCommandBuilder->withRepository($repositoryName); } - $this->logger->info(\json_encode($satisCommandBuilder->build())); + $this->logger->info(\json_encode($satisCommandBuilder->build(), \JSON_THROW_ON_ERROR)); return $satisCommandBuilder->build(); } diff --git a/tests/Service/LockProcessorTest.php b/tests/Service/LockProcessorTest.php new file mode 100644 index 0000000..34fd88a --- /dev/null +++ b/tests/Service/LockProcessorTest.php @@ -0,0 +1,81 @@ +createMock(RepositoryManager::class); + $manager->expects($this->once()) + ->method('addAll') + ->with($this->callback(function ($repositories) { + return 2 === \count($repositories) + && $repositories[0] instanceof Repository + && 'https://example.com/repo1.git' === $repositories[0]->getUrl() + && 'git' === $repositories[0]->getType() + && $repositories[1] instanceof Repository + && 'https://example.com/repo2.git' === $repositories[1]->getUrl() + && 'git' === $repositories[1]->getType(); + })); + + $processor = new LockProcessor($manager); + $processor->processFile($file); + + \fclose($tmpFile); + } + + public function testGetRepositoriesFiltersInvalidPackages(): void + { + $manager = $this->createMock(RepositoryManager::class); + $processor = new LockProcessor($manager); + + $packages = [ + (object) [ + 'name' => 'vendor/valid', + 'source' => (object) ['url' => 'https://example.com/repo.git', 'type' => 'git'], + ], + (object) [ + 'name' => 'vendor/invalid', + 'source' => (object) ['url' => '', 'type' => ''], + ], + (object) [ + 'name' => 'vendor/nosource', + ], + ]; + + $method = new \ReflectionMethod(LockProcessor::class, 'getRepositories'); + $repositories = $method->invoke($processor, $packages); + + $this->assertCount(1, $repositories); + $this->assertSame('https://example.com/repo.git', $repositories[0]->getUrl()); + $this->assertSame('git', $repositories[0]->getType()); + } +} diff --git a/tests/Service/SatisCommandBuilderTest.php b/tests/Service/SatisCommandBuilderTest.php new file mode 100644 index 0000000..a9d1649 --- /dev/null +++ b/tests/Service/SatisCommandBuilderTest.php @@ -0,0 +1,70 @@ +assertSame('satis.json', $builder->configFile); + $this->assertSame('output', $builder->outputDir); + } + + public function testWithRepositoryAddsRepositoryNameToOptions(): void + { + $builder = SatisCommandBuilder::from('satis.json', 'output') + ->withRepository('my-repo'); + + $command = $builder->build(); + + $this->assertContains('my-repo', $command); + } + + public function testAddOptionAndAddOptionsMergeOptions(): void + { + $builder = SatisCommandBuilder::from('satis.json', 'output'); + $builder->addOptions(['--option1', '--option2']); + + $command = $builder->build(); + + $this->assertContains('--option1', $command); + $this->assertContains('--option2', $command); + $this->assertContains('--skip-errors', $command); + $this->assertContains('--no-ansi', $command); + $this->assertContains('--verbose', $command); + } + + public function testAddArgsAddsExtraArguments(): void + { + $builder = SatisCommandBuilder::from('satis.json', 'output'); + $builder->addArgs(['arg1', 'arg2']); + + $command = $builder->build(); + + $this->assertContains('arg1', $command); + $this->assertContains('arg2', $command); + } + + public function testBuildReturnsFullCommandArray(): void + { + $builder = SatisCommandBuilder::from('satis.json', 'output') + ->withRepository('my-repo') + ->addOptions(['--option']) + ->addArgs(['arg']); + + $command = $builder->build(); + + $this->assertSame('vendor/bin/satis', $command[0]); + $this->assertSame('build', $command[1]); + $this->assertSame('satis.json', $command[2]); + $this->assertSame('output', $command[3]); + $this->assertContains('my-repo', $command); + $this->assertContains('--option', $command); + $this->assertContains('arg', $command); + } +} From e10ae4f3702f889f6086c7da18b2024920373307 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 15:58:53 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`tes?= =?UTF-8?q?t-improving-code-coverage`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @Trusted97. * https://github.com/Trusted97/satifly/pull/2#issuecomment-3586575422 The following files were modified: * `config/reference.php` * `src/Service/SatisManager.php` --- config/reference.php | 10 +++++++--- src/Service/SatisManager.php | 24 ++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/config/reference.php b/config/reference.php index 599a33d..fc02d47 100644 --- a/config/reference.php +++ b/config/reference.php @@ -1266,8 +1266,9 @@ final class App { /** - * @param ConfigType $config + * Provides the application's service and extension configuration. * + * @param ConfigType $config The configuration structure for the application (see `ConfigType` psalm type aliases defined above). * @psalm-return ConfigType */ public static function config(array $config): array @@ -1344,12 +1345,15 @@ public static function config(array $config): array final class Routes { /** - * @param RoutesConfig $config + * Builds and returns a routes configuration array for the application. + * + * The configuration may contain RouteConfig, ImportConfig, or AliasConfig entries and may use environment-scoped keys (e.g. "when@dev"). * + * @param RoutesConfig $config * @psalm-return RoutesConfig */ public static function config(array $config): array { return $config; } -} +} \ No newline at end of file diff --git a/src/Service/SatisManager.php b/src/Service/SatisManager.php index d47bf7a..6796976 100644 --- a/src/Service/SatisManager.php +++ b/src/Service/SatisManager.php @@ -62,6 +62,17 @@ public function run(): \Generator } } + /** + * Handle a BuildEvent by executing the Satis build for the event's repository. + * + * Acquires the build lock, runs the generated Satis process, releases the lock, + * and updates the event's status with the process exit code (`1` if an internal + * RuntimeException occurs). + * + * @param BuildEvent $event The build event; its repository (if any) is used to + * determine the build target and its status will be + * updated with the process exit code. + */ public function onBuild(BuildEvent $event): void { $repository = $event->getRepository(); @@ -81,7 +92,16 @@ public function onBuild(BuildEvent $event): void } /** - * @throws \JsonException + * Build the command argument array for executing a Satis build. + * + * Constructs a command array based on the configured satis file and output directory, + * optionally scoping the build to a single repository and adding extra options or arguments. + * + * @param string|null $repositoryName Name of a single repository to target, or `null` to include all repositories. + * @param array $options Associative or list-style Satis options to include (added via the builder's options API). + * @param array $extraArgs Additional positional arguments to append to the command. + * @return array The constructed command as an array of command and arguments suitable for Process execution. + * @throws \JsonException If encoding the built command to JSON for logging fails. */ protected function getCommandLine(?string $repositoryName = null, array $options = [], array $extraArgs = []): array { @@ -111,4 +131,4 @@ protected function trimLine(string $line): string { return \mb_trim($line, " \t\n\r\0\x0B\x08"); } -} +} \ No newline at end of file From 53dcbfcf40ebff4ffeab2cf7a51676c74d789de1 Mon Sep 17 00:00:00 2001 From: Trusted97 Date: Thu, 27 Nov 2025 17:01:16 +0100 Subject: [PATCH 3/4] chore: simplify logic for ProcessFactory --- src/Process/EnvironmentProvider.php | 33 +++++++++++++++++++ src/Process/ProcessFactory.php | 50 +++++++++-------------------- 2 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 src/Process/EnvironmentProvider.php diff --git a/src/Process/EnvironmentProvider.php b/src/Process/EnvironmentProvider.php new file mode 100644 index 0000000..f18b748 --- /dev/null +++ b/src/Process/EnvironmentProvider.php @@ -0,0 +1,33 @@ + $value) { + if (\is_string($value) && false !== $envValue = \getenv($key)) { + $env[$key] = $envValue; + } + } + + foreach ($_ENV as $key => $value) { + if (\is_string($value)) { + $env[$key] = $value; + } + } + + $env['COMPOSER_HOME'] ??= $this->composerHome; + $env['COMPOSER_NO_INTERACTION'] = '1'; + + return $env; + } +} diff --git a/src/Process/ProcessFactory.php b/src/Process/ProcessFactory.php index 2043cb9..e50ee81 100644 --- a/src/Process/ProcessFactory.php +++ b/src/Process/ProcessFactory.php @@ -4,47 +4,27 @@ use Symfony\Component\Process\Process; -class ProcessFactory +final readonly class ProcessFactory { - protected string $rootPath; - - protected string $composerHome; - - public function __construct(string $rootPath, string $composerHome) - { - $this->rootPath = $rootPath; - $this->composerHome = $composerHome; - } + public function __construct( + private string $rootPath, + private EnvironmentProvider $envProvider + ) {} public function create(array $command, ?int $timeout = null): Process { - $exec = \reset($command); - $command[\key($command)] = $this->rootPath . '/' . $exec; - - return new Process($command, $this->rootPath, $this->getEnv(), null, $timeout); - } - - protected function getEnv(): array - { - $env = []; - - foreach ($_SERVER as $k => $v) { - if (\is_string($v) && false !== $v = \getenv($k)) { - $env[$k] = $v; - } + if (empty($command)) { + throw new \InvalidArgumentException('Command array cannot be empty.'); } - foreach ($_ENV as $k => $v) { - if (\is_string($v)) { - $env[$k] = $v; - } - } - - if (empty($env['COMPOSER_HOME'])) { - $env['COMPOSER_HOME'] = $this->composerHome; - } - $env['COMPOSER_NO_INTERACTION'] = 1; + $command[0] = $this->rootPath . '/' . $command[0]; - return $env; + return new Process( + command: $command, + cwd: $this->rootPath, + env: $this->envProvider->getEnv(), + input: null, + timeout: $timeout + ); } } From 694889750fe2a88b01c4743b79b0b3d07fd30a73 Mon Sep 17 00:00:00 2001 From: Trusted97 Date: Fri, 28 Nov 2025 09:24:38 +0100 Subject: [PATCH 4/4] chore: adding test for ProcessFactory --- config/reference.php | 10 +--- config/services.yaml | 7 ++- src/Process/EnvironmentProvider.php | 4 +- src/Process/ProcessFactory.php | 5 +- src/Service/SatisManager.php | 20 ++++--- tests/Process/EnvironmentProviderTest.php | 67 +++++++++++++++++++++++ tests/Process/ProcessFactoryTest.php | 51 +++++++++++++++++ 7 files changed, 144 insertions(+), 20 deletions(-) create mode 100644 tests/Process/EnvironmentProviderTest.php create mode 100644 tests/Process/ProcessFactoryTest.php diff --git a/config/reference.php b/config/reference.php index fc02d47..599a33d 100644 --- a/config/reference.php +++ b/config/reference.php @@ -1266,9 +1266,8 @@ final class App { /** - * Provides the application's service and extension configuration. + * @param ConfigType $config * - * @param ConfigType $config The configuration structure for the application (see `ConfigType` psalm type aliases defined above). * @psalm-return ConfigType */ public static function config(array $config): array @@ -1345,15 +1344,12 @@ public static function config(array $config): array final class Routes { /** - * Builds and returns a routes configuration array for the application. - * - * The configuration may contain RouteConfig, ImportConfig, or AliasConfig entries and may use environment-scoped keys (e.g. "when@dev"). - * * @param RoutesConfig $config + * * @psalm-return RoutesConfig */ public static function config(array $config): array { return $config; } -} \ No newline at end of file +} diff --git a/config/services.yaml b/config/services.yaml index c532059..ad68a97 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -51,10 +51,15 @@ services: tags: - { name: serializer.normalizer, priority: 1000 } + App\Process\EnvironmentProvider: + arguments: + $composerHome: "%composer.home%" + + App\Process\ProcessFactory: arguments: $rootPath: "%kernel.project_dir%" - $composerHome: "%composer.home%" + $envProvider: '@App\Process\EnvironmentProvider' App\Service\SatisManager: public: true diff --git a/src/Process/EnvironmentProvider.php b/src/Process/EnvironmentProvider.php index f18b748..6f94649 100644 --- a/src/Process/EnvironmentProvider.php +++ b/src/Process/EnvironmentProvider.php @@ -2,10 +2,10 @@ namespace App\Process; -final readonly class EnvironmentProvider +class EnvironmentProvider { public function __construct( - private string $composerHome, + private readonly string $composerHome, ) { } diff --git a/src/Process/ProcessFactory.php b/src/Process/ProcessFactory.php index e50ee81..3f18fd5 100644 --- a/src/Process/ProcessFactory.php +++ b/src/Process/ProcessFactory.php @@ -8,8 +8,9 @@ { public function __construct( private string $rootPath, - private EnvironmentProvider $envProvider - ) {} + private EnvironmentProvider $envProvider, + ) { + } public function create(array $command, ?int $timeout = null): Process { diff --git a/src/Service/SatisManager.php b/src/Service/SatisManager.php index 6796976..e32ee9a 100644 --- a/src/Service/SatisManager.php +++ b/src/Service/SatisManager.php @@ -69,9 +69,11 @@ public function run(): \Generator * and updates the event's status with the process exit code (`1` if an internal * RuntimeException occurs). * - * @param BuildEvent $event The build event; its repository (if any) is used to + * @param BuildEvent $event the build event; its repository (if any) is used to * determine the build target and its status will be - * updated with the process exit code. + * updated with the process exit code + * + * @throws \JsonException */ public function onBuild(BuildEvent $event): void { @@ -97,11 +99,13 @@ public function onBuild(BuildEvent $event): void * Constructs a command array based on the configured satis file and output directory, * optionally scoping the build to a single repository and adding extra options or arguments. * - * @param string|null $repositoryName Name of a single repository to target, or `null` to include all repositories. - * @param array $options Associative or list-style Satis options to include (added via the builder's options API). - * @param array $extraArgs Additional positional arguments to append to the command. - * @return array The constructed command as an array of command and arguments suitable for Process execution. - * @throws \JsonException If encoding the built command to JSON for logging fails. + * @param string|null $repositoryName name of a single repository to target, or `null` to include all repositories + * @param array $options associative or list-style Satis options to include (added via the builder's options API) + * @param array $extraArgs additional positional arguments to append to the command + * + * @throws \JsonException if encoding the built command to JSON for logging fails + * + * @return array the constructed command as an array of command and arguments suitable for Process execution */ protected function getCommandLine(?string $repositoryName = null, array $options = [], array $extraArgs = []): array { @@ -131,4 +135,4 @@ protected function trimLine(string $line): string { return \mb_trim($line, " \t\n\r\0\x0B\x08"); } -} \ No newline at end of file +} diff --git a/tests/Process/EnvironmentProviderTest.php b/tests/Process/EnvironmentProviderTest.php new file mode 100644 index 0000000..2f6d8ef --- /dev/null +++ b/tests/Process/EnvironmentProviderTest.php @@ -0,0 +1,67 @@ +get(ParameterBagInterface::class); + $provider = new EnvironmentProvider($parameterBag->get('composer.home')); + + $env = $provider->getEnv(); + + $this->assertSame('/app/var/composer', $env['COMPOSER_HOME']); + $this->assertSame('1', $env['COMPOSER_NO_INTERACTION']); + } + + public function testGetEnvIncludesServerVariables(): void + { + $_SERVER['TEST_KEY'] = 'value'; + \putenv('TEST_KEY=value'); + + $parameterBag = static::getContainer()->get(ParameterBagInterface::class); + $provider = new EnvironmentProvider($parameterBag->get('composer.home')); + + $env = $provider->getEnv(); + + $this->assertArrayHasKey('TEST_KEY', $env); + $this->assertSame('value', $env['TEST_KEY']); + } + + public function testGetEnvIncludesEnvVariables(): void + { + $_ENV['TEST_ENV_KEY'] = 'env_value'; + + $parameterBag = static::getContainer()->get(ParameterBagInterface::class); + $provider = new EnvironmentProvider($parameterBag->get('composer.home')); + + $env = $provider->getEnv(); + + $this->assertArrayHasKey('TEST_ENV_KEY', $env); + $this->assertSame('env_value', $env['TEST_ENV_KEY']); + } + + public function testComposerHomeNotOverwrittenIfProvidedInEnv(): void + { + \putenv('COMPOSER_HOME=/app/var/composer'); + $_SERVER['COMPOSER_HOME'] = '/app/var/composer'; + + $parameterBag = static::getContainer()->get(ParameterBagInterface::class); + $provider = new EnvironmentProvider($parameterBag->get('composer.home')); + + $env = $provider->getEnv(); + + $this->assertSame('/app/var/composer', $env['COMPOSER_HOME']); + } +} diff --git a/tests/Process/ProcessFactoryTest.php b/tests/Process/ProcessFactoryTest.php new file mode 100644 index 0000000..aa783f5 --- /dev/null +++ b/tests/Process/ProcessFactoryTest.php @@ -0,0 +1,51 @@ + 'B']; + + $provider = $this->createMock(EnvironmentProvider::class); + $provider->method('getEnv')->willReturn($env); + + $factory = new ProcessFactory('/root', $provider); + + $process = $factory->create(['bin/tool', 'arg1', 'arg2'], 123); + + $this->assertInstanceOf(Process::class, $process); + $this->assertSame('\'/root/bin/tool\' \'arg1\' \'arg2\'', $process->getCommandLine()); + $this->assertSame('/root', $process->getWorkingDirectory()); + $this->assertSame($env, $process->getEnv()); + $this->assertSame(123.0, $process->getTimeout()); + } + + public function testCreateThrowsOnEmptyCommand(): void + { + $provider = $this->createMock(EnvironmentProvider::class); + $factory = new ProcessFactory('/root', $provider); + + $this->expectException(\InvalidArgumentException::class); + + $factory->create([]); + } + + public function testCommandIsPrefixedWithRootPath(): void + { + $provider = $this->createMock(EnvironmentProvider::class); + $provider->method('getEnv')->willReturn([]); + + $factory = new ProcessFactory('/abc', $provider); + + $process = $factory->create(['vendor/bin/satis']); + + $this->assertSame('\'/abc/vendor/bin/satis\'', $process->getCommandLine()); + } +}