From ce4032f7524a64008794a6829d2e0212c4cbc42a Mon Sep 17 00:00:00 2001 From: Giuseppe Mazzapica Date: Thu, 25 Nov 2021 16:51:49 +0100 Subject: [PATCH] Add visibility to all class constants --- src/Cli/WpCliFileData.php | 10 ++--- src/ComposerPlugin.php | 16 ++++---- src/Config/Config.php | 64 +++++++++++++++--------------- src/Env/Filters.php | 14 +++---- src/Env/WordPressEnvBridge.php | 24 +++++------ src/Io/Formatter.php | 2 +- src/Step/CheckPathStep.php | 2 +- src/Step/ContentDevStep.php | 10 ++--- src/Step/DropinStep.php | 4 +- src/Step/DropinsStep.php | 4 +- src/Step/EnvExampleStep.php | 2 +- src/Step/FlushEnvCacheStep.php | 2 +- src/Step/IndexStep.php | 2 +- src/Step/MoveContentStep.php | 2 +- src/Step/MuLoaderStep.php | 4 +- src/Step/OptionalStep.php | 2 +- src/Step/Step.php | 6 +-- src/Step/WpCliCommandsStep.php | 2 +- src/Step/WpCliConfigStep.php | 2 +- src/Step/WpConfigStep.php | 2 +- src/Util/DbChecker.php | 6 +-- src/Util/Paths.php | 14 +++---- src/Util/Requirements.php | 2 +- src/Util/Salter.php | 6 +-- src/Util/SelectedStepsFactory.php | 8 ++-- src/Util/WpConfigSectionEditor.php | 6 +-- src/Util/WpVersion.php | 4 +- 27 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/Cli/WpCliFileData.php b/src/Cli/WpCliFileData.php index 9bd3e4a..366250c 100644 --- a/src/Cli/WpCliFileData.php +++ b/src/Cli/WpCliFileData.php @@ -13,11 +13,11 @@ final class WpCliFileData { - const FILE = 'file'; - const ARGS = 'args'; - const SKIP_WORDPRESS = 'skip-wordpress'; - const VALID = 'valid'; - const DEFAULTS = [ + public const FILE = 'file'; + public const ARGS = 'args'; + public const SKIP_WORDPRESS = 'skip-wordpress'; + public const VALID = 'valid'; + public const DEFAULTS = [ self::FILE => '', self::ARGS => [], self::SKIP_WORDPRESS => false, diff --git a/src/ComposerPlugin.php b/src/ComposerPlugin.php index 8661280..92b4879 100644 --- a/src/ComposerPlugin.php +++ b/src/ComposerPlugin.php @@ -38,14 +38,14 @@ final class ComposerPlugin implements CommandProvider { - const EXTRA_KEY = 'wpstarter'; - const EXTENSIONS_TYPE = 'wpstarter-extension'; - - const MODE = 'mode'; - const MODE_NONE = 0; - const MODE_COMMAND = 1; - const MODE_COMPOSER_INSTALL = 4; - const MODE_COMPOSER_UPDATE = 8; + public const EXTRA_KEY = 'wpstarter'; + public const EXTENSIONS_TYPE = 'wpstarter-extension'; + + public const MODE = 'mode'; + public const MODE_NONE = 0; + public const MODE_COMMAND = 1; + public const MODE_COMPOSER_INSTALL = 4; + public const MODE_COMPOSER_UPDATE = 8; /** * @var bool diff --git a/src/Config/Config.php b/src/Config/Config.php index 61625d3..cb920c1 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -21,38 +21,38 @@ */ final class Config implements \ArrayAccess { - const AUTOLOAD = 'autoload'; - const CACHE_ENV = 'cache-env'; - const COMMAND_STEPS = 'command-steps'; - const COMPOSER_UPDATED_PACKAGES = 'composer-updated-packages'; - const CONTENT_DEV_DIR = 'content-dev-dir'; - const CONTENT_DEV_OPERATION = 'content-dev-op'; - const CUSTOM_STEPS = 'custom-steps'; - const DROPINS = 'dropins'; - const EARLY_HOOKS_FILE = 'early-hook-file'; - const ENV_BOOTSTRAP_DIR = 'env-bootstrap-dir'; - const ENV_DIR = 'env-dir'; - const ENV_EXAMPLE = 'env-example'; - const ENV_FILE = 'env-file'; - const INSTALL_WP_CLI = 'install-wp-cli'; - const IS_COMPOSER_UPDATE = 'is-composer-update'; - const IS_COMPOSER_INSTALL = 'is-composer-install'; - const IS_WPSTARTER_COMMAND = 'is-wpstarter-command'; - const IS_WPSTARTER_SELECTED_COMMAND = 'is-wpstarter-selected-command'; - const MOVE_CONTENT = 'move-content'; - const PREVENT_OVERWRITE = 'prevent-overwrite'; - const REGISTER_THEME_FOLDER = 'register-theme-folder'; - const REQUIRE_WP = 'require-wp'; - const SCRIPTS = 'scripts'; - const SKIP_DB_CHECK = 'skip-db-check'; - const SKIP_STEPS = 'skip-steps'; - const TEMPLATES_DIR = 'templates-dir'; - const UNKNOWN_DROPINS = 'unknown-dropins'; - const WP_CLI_COMMANDS = 'wp-cli-commands'; - const WP_CLI_FILES = 'wp-cli-files'; - const WP_VERSION = 'wp-version'; + public const AUTOLOAD = 'autoload'; + public const CACHE_ENV = 'cache-env'; + public const COMMAND_STEPS = 'command-steps'; + public const COMPOSER_UPDATED_PACKAGES = 'composer-updated-packages'; + public const CONTENT_DEV_DIR = 'content-dev-dir'; + public const CONTENT_DEV_OPERATION = 'content-dev-op'; + public const CUSTOM_STEPS = 'custom-steps'; + public const DROPINS = 'dropins'; + public const EARLY_HOOKS_FILE = 'early-hook-file'; + public const ENV_BOOTSTRAP_DIR = 'env-bootstrap-dir'; + public const ENV_DIR = 'env-dir'; + public const ENV_EXAMPLE = 'env-example'; + public const ENV_FILE = 'env-file'; + public const INSTALL_WP_CLI = 'install-wp-cli'; + public const IS_COMPOSER_UPDATE = 'is-composer-update'; + public const IS_COMPOSER_INSTALL = 'is-composer-install'; + public const IS_WPSTARTER_COMMAND = 'is-wpstarter-command'; + public const IS_WPSTARTER_SELECTED_COMMAND = 'is-wpstarter-selected-command'; + public const MOVE_CONTENT = 'move-content'; + public const PREVENT_OVERWRITE = 'prevent-overwrite'; + public const REGISTER_THEME_FOLDER = 'register-theme-folder'; + public const REQUIRE_WP = 'require-wp'; + public const SCRIPTS = 'scripts'; + public const SKIP_DB_CHECK = 'skip-db-check'; + public const SKIP_STEPS = 'skip-steps'; + public const TEMPLATES_DIR = 'templates-dir'; + public const UNKNOWN_DROPINS = 'unknown-dropins'; + public const WP_CLI_COMMANDS = 'wp-cli-commands'; + public const WP_CLI_FILES = 'wp-cli-files'; + public const WP_VERSION = 'wp-version'; - const DEFAULTS = [ + public const DEFAULTS = [ self::AUTOLOAD => 'wpstarter-autoload.php', self::CACHE_ENV => true, self::COMMAND_STEPS => null, @@ -85,7 +85,7 @@ final class Config implements \ArrayAccess self::WP_VERSION => null, ]; - const VALIDATION_MAP = [ + public const VALIDATION_MAP = [ self::AUTOLOAD => 'validatePath', self::CACHE_ENV => 'validateBool', self::COMMAND_STEPS => 'validateSteps', diff --git a/src/Env/Filters.php b/src/Env/Filters.php index 01426a8..1257c98 100644 --- a/src/Env/Filters.php +++ b/src/Env/Filters.php @@ -27,13 +27,13 @@ */ final class Filters { - const FILTER_BOOL = 'bool'; - const FILTER_INT = 'int'; - const FILTER_INT_OR_BOOL = 'int|bool'; - const FILTER_STRING_OR_BOOL = 'string|bool'; - const FILTER_STRING = 'string'; - const FILTER_OCTAL_MOD = 'mod'; - const FILTER_TABLE_PREFIX = 'table-prefix'; + public const FILTER_BOOL = 'bool'; + public const FILTER_INT = 'int'; + public const FILTER_INT_OR_BOOL = 'int|bool'; + public const FILTER_STRING_OR_BOOL = 'string|bool'; + public const FILTER_STRING = 'string'; + public const FILTER_OCTAL_MOD = 'mod'; + public const FILTER_TABLE_PREFIX = 'table-prefix'; /** * @param string $name diff --git a/src/Env/WordPressEnvBridge.php b/src/Env/WordPressEnvBridge.php index 917b603..1481ab3 100644 --- a/src/Env/WordPressEnvBridge.php +++ b/src/Env/WordPressEnvBridge.php @@ -18,7 +18,7 @@ */ class WordPressEnvBridge { - const WP_CONSTANTS = [ + public const WP_CONSTANTS = [ 'ABSPATH' => Filters::FILTER_STRING, 'ADMIN_COOKIE_PATH' => Filters::FILTER_STRING, 'ALLOW_SUBDIRECTORY_INSTALL' => Filters::FILTER_BOOL, @@ -179,16 +179,16 @@ class WordPressEnvBridge 'WP_USE_EXT_MYSQL' => Filters::FILTER_BOOL, ]; - const CACHE_DUMP_FILE = '/.env.cached.php'; - const CUSTOM_ENV_TO_CONST_VAR_NAME = 'WP_STARTER_ENV_TO_CONST'; - const DB_TABLE_PREFIX_VAR_NAME = 'DB_TABLE_PREFIX'; - const WP_ADMIN_COLOR_VAR_NAME = 'WP_ADMIN_COLOR'; - const WP_FORCE_SSL_FORWARDED_PROTO_VAR_NAME = 'WP_FORCE_SSL_FORWARDED_PROTO'; - const WP_INSTALLED_VAR_NAME = 'WP_INSTALLED'; - const WPDB_ENV_VALID_VAR_NAME = 'WPDB_ENV_VALID'; - const WPDB_EXISTS_VAR_NAME = 'WPDB_EXISTS'; + public const CACHE_DUMP_FILE = '/.env.cached.php'; + public const CUSTOM_ENV_TO_CONST_VAR_NAME = 'WP_STARTER_ENV_TO_CONST'; + public const DB_TABLE_PREFIX_VAR_NAME = 'DB_TABLE_PREFIX'; + public const WP_ADMIN_COLOR_VAR_NAME = 'WP_ADMIN_COLOR'; + public const WP_FORCE_SSL_FORWARDED_PROTO_VAR_NAME = 'WP_FORCE_SSL_FORWARDED_PROTO'; + public const WP_INSTALLED_VAR_NAME = 'WP_INSTALLED'; + public const WPDB_ENV_VALID_VAR_NAME = 'WPDB_ENV_VALID'; + public const WPDB_EXISTS_VAR_NAME = 'WPDB_EXISTS'; - const WP_STARTER_VARS = [ + public const WP_STARTER_VARS = [ self::CUSTOM_ENV_TO_CONST_VAR_NAME => Filters::FILTER_STRING, self::DB_TABLE_PREFIX_VAR_NAME => Filters::FILTER_TABLE_PREFIX, self::WP_ADMIN_COLOR_VAR_NAME => Filters::FILTER_STRING, @@ -198,13 +198,13 @@ class WordPressEnvBridge self::WPDB_EXISTS_VAR_NAME => Filters::FILTER_BOOL, ]; - const WP_STARTER_ENV_VARS = [ + public const WP_STARTER_ENV_VARS = [ 'WP_ENV', 'WORDPRESS_ENV', 'WP_ENVIRONMENT_TYPE', ]; - const ENV_TYPES = [ + public const ENV_TYPES = [ 'local' => 'local', 'development' => 'development', 'dev' => 'development', diff --git a/src/Io/Formatter.php b/src/Io/Formatter.php index 988d0b7..e0ac40a 100644 --- a/src/Io/Formatter.php +++ b/src/Io/Formatter.php @@ -13,7 +13,7 @@ class Formatter { - const DEFAULT_LINE_LENGTH = 58; + public const DEFAULT_LINE_LENGTH = 58; /** * @param int $lineLength diff --git a/src/Step/CheckPathStep.php b/src/Step/CheckPathStep.php index 9f733bf..467a5fe 100644 --- a/src/Step/CheckPathStep.php +++ b/src/Step/CheckPathStep.php @@ -21,7 +21,7 @@ */ final class CheckPathStep implements BlockingStep, PostProcessStep { - const NAME = 'check-paths'; + public const NAME = 'check-paths'; /** * @var \WeCodeMore\WpStarter\Util\Filesystem diff --git a/src/Step/ContentDevStep.php b/src/Step/ContentDevStep.php index ccba407..4686fdb 100644 --- a/src/Step/ContentDevStep.php +++ b/src/Step/ContentDevStep.php @@ -41,11 +41,11 @@ */ final class ContentDevStep implements OptionalStep { - const NAME = 'publish-content-dev'; - const OP_COPY = 'copy'; - const OP_SYMLINK = 'symlink'; - const OP_NONE = 'none'; - const OPERATIONS = [self::OP_COPY, self::OP_SYMLINK, self::OP_NONE]; + public const NAME = 'publish-content-dev'; + public const OP_COPY = 'copy'; + public const OP_SYMLINK = 'symlink'; + public const OP_NONE = 'none'; + public const OPERATIONS = [self::OP_COPY, self::OP_SYMLINK, self::OP_NONE]; /** * @var \WeCodeMore\WpStarter\Util\Filesystem diff --git a/src/Step/DropinStep.php b/src/Step/DropinStep.php index 4167cf3..9de7dfb 100644 --- a/src/Step/DropinStep.php +++ b/src/Step/DropinStep.php @@ -24,8 +24,8 @@ */ final class DropinStep implements FileCreationStepInterface { - const ACTION_COPY = 'copy'; - const ACTION_DOWNLOAD = 'download'; + public const ACTION_COPY = 'copy'; + public const ACTION_DOWNLOAD = 'download'; /** * @var string diff --git a/src/Step/DropinsStep.php b/src/Step/DropinsStep.php index 884a521..b9d3450 100644 --- a/src/Step/DropinsStep.php +++ b/src/Step/DropinsStep.php @@ -28,9 +28,9 @@ */ final class DropinsStep implements Step { - const NAME = 'dropins'; + public const NAME = 'dropins'; - const DROPINS = [ + public const DROPINS = [ 'advanced-cache.php', 'db.php', 'db-error.php', diff --git a/src/Step/EnvExampleStep.php b/src/Step/EnvExampleStep.php index 6679057..0306395 100644 --- a/src/Step/EnvExampleStep.php +++ b/src/Step/EnvExampleStep.php @@ -27,7 +27,7 @@ */ final class EnvExampleStep implements FileCreationStepInterface, OptionalStep { - const NAME = 'build-env-example'; + public const NAME = 'build-env-example'; /** * @var Config diff --git a/src/Step/FlushEnvCacheStep.php b/src/Step/FlushEnvCacheStep.php index c192abe..5093815 100644 --- a/src/Step/FlushEnvCacheStep.php +++ b/src/Step/FlushEnvCacheStep.php @@ -20,7 +20,7 @@ */ final class FlushEnvCacheStep implements Step { - const NAME = 'flush-env-cache'; + public const NAME = 'flush-env-cache'; /** * @return string diff --git a/src/Step/IndexStep.php b/src/Step/IndexStep.php index 73af1f3..4691c72 100644 --- a/src/Step/IndexStep.php +++ b/src/Step/IndexStep.php @@ -23,7 +23,7 @@ */ final class IndexStep implements FileCreationStepInterface, BlockingStep { - const NAME = 'build-index'; + public const NAME = 'build-index'; /** * @var \WeCodeMore\WpStarter\Util\FileContentBuilder diff --git a/src/Step/MoveContentStep.php b/src/Step/MoveContentStep.php index 87c6891..88bbf06 100644 --- a/src/Step/MoveContentStep.php +++ b/src/Step/MoveContentStep.php @@ -28,7 +28,7 @@ */ final class MoveContentStep implements OptionalStep { - const NAME = 'move-content'; + public const NAME = 'move-content'; /** * @var \WeCodeMore\WpStarter\Util\Filesystem diff --git a/src/Step/MuLoaderStep.php b/src/Step/MuLoaderStep.php index f3b0d31..36fd355 100644 --- a/src/Step/MuLoaderStep.php +++ b/src/Step/MuLoaderStep.php @@ -27,8 +27,8 @@ */ final class MuLoaderStep implements FileCreationStepInterface { - const NAME = 'build-mu-loader'; - const TARGET_FILE_NAME = 'wpstarter-mu-loader.php'; + public const NAME = 'build-mu-loader'; + public const TARGET_FILE_NAME = 'wpstarter-mu-loader.php'; /** * @var \WeCodeMore\WpStarter\Util\MuPluginList diff --git a/src/Step/OptionalStep.php b/src/Step/OptionalStep.php index 9618e7d..ea06879 100644 --- a/src/Step/OptionalStep.php +++ b/src/Step/OptionalStep.php @@ -17,7 +17,7 @@ */ interface OptionalStep extends Step { - const ASK = 'ask'; + public const ASK = 'ask'; /** * Ask a confirmation and return result. diff --git a/src/Step/Step.php b/src/Step/Step.php index f82bbe3..2da4aa9 100644 --- a/src/Step/Step.php +++ b/src/Step/Step.php @@ -17,9 +17,9 @@ */ interface Step { - const ERROR = 1; - const SUCCESS = 2; - const NONE = 4; + public const ERROR = 1; + public const SUCCESS = 2; + public const NONE = 4; /** * Return an unique name for the step. diff --git a/src/Step/WpCliCommandsStep.php b/src/Step/WpCliCommandsStep.php index ada2be6..3d72b45 100644 --- a/src/Step/WpCliCommandsStep.php +++ b/src/Step/WpCliCommandsStep.php @@ -29,7 +29,7 @@ final class WpCliCommandsStep implements Step { - const NAME = 'wp-cli'; + public const NAME = 'wp-cli'; /** * @var Io diff --git a/src/Step/WpCliConfigStep.php b/src/Step/WpCliConfigStep.php index 56aae6d..9820f7c 100644 --- a/src/Step/WpCliConfigStep.php +++ b/src/Step/WpCliConfigStep.php @@ -22,7 +22,7 @@ */ final class WpCliConfigStep implements FileCreationStepInterface { - const NAME = 'build-wp-cli-yml'; + public const NAME = 'build-wp-cli-yml'; /** * @var Util\FileContentBuilder diff --git a/src/Step/WpConfigStep.php b/src/Step/WpConfigStep.php index cb98995..030a693 100644 --- a/src/Step/WpConfigStep.php +++ b/src/Step/WpConfigStep.php @@ -23,7 +23,7 @@ */ final class WpConfigStep implements FileCreationStepInterface, BlockingStep { - const NAME = 'build-wp-config'; + public const NAME = 'build-wp-config'; /** * @var \WeCodeMore\WpStarter\Io\Io diff --git a/src/Util/DbChecker.php b/src/Util/DbChecker.php index 40c769b..e344211 100644 --- a/src/Util/DbChecker.php +++ b/src/Util/DbChecker.php @@ -19,9 +19,9 @@ */ class DbChecker { - const WP_INSTALLED = 'WP_INSTALLED'; - const WPDB_EXISTS = 'WPDB_EXISTS'; - const WPDB_ENV_VALID = 'WPDB_ENV_VALID'; + public const WP_INSTALLED = 'WP_INSTALLED'; + public const WPDB_EXISTS = 'WPDB_EXISTS'; + public const WPDB_ENV_VALID = 'WPDB_ENV_VALID'; /** * @var WordPressEnvBridge diff --git a/src/Util/Paths.php b/src/Util/Paths.php index 9ef0649..54563cf 100644 --- a/src/Util/Paths.php +++ b/src/Util/Paths.php @@ -22,13 +22,13 @@ */ final class Paths implements \ArrayAccess { - const ROOT = 'root'; - const VENDOR = 'vendor'; - const BIN = 'bin'; - const WP = 'wp'; - const WP_PARENT = 'wp-parent'; - const WP_CONTENT = 'wp-content'; - const WP_STARTER = 'wp-starter'; + public const ROOT = 'root'; + public const VENDOR = 'vendor'; + public const BIN = 'bin'; + public const WP = 'wp'; + public const WP_PARENT = 'wp-parent'; + public const WP_CONTENT = 'wp-content'; + public const WP_STARTER = 'wp-starter'; /** * @var Config diff --git a/src/Util/Requirements.php b/src/Util/Requirements.php index 51e80d3..40c84f4 100644 --- a/src/Util/Requirements.php +++ b/src/Util/Requirements.php @@ -26,7 +26,7 @@ */ final class Requirements { - const CONFIG_FILE = 'wpstarter.json'; + public const CONFIG_FILE = 'wpstarter.json'; /** * @var Filesystem diff --git a/src/Util/Salter.php b/src/Util/Salter.php index a20ceb6..cb1a561 100644 --- a/src/Util/Salter.php +++ b/src/Util/Salter.php @@ -16,10 +16,10 @@ */ class Salter { - const CHARS_1 = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - const CHARS_2 = ' =,.;:/?!|@#$%^&*()-_[]{}<>~`+'; + public const CHARS_1 = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + public const CHARS_2 = ' =,.;:/?!|@#$%^&*()-_[]{}<>~`+'; - const KEYS = [ + public const KEYS = [ 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', diff --git a/src/Util/SelectedStepsFactory.php b/src/Util/SelectedStepsFactory.php index ad5931c..d5ca152 100644 --- a/src/Util/SelectedStepsFactory.php +++ b/src/Util/SelectedStepsFactory.php @@ -20,10 +20,10 @@ class SelectedStepsFactory { - const MODE_COMMAND = 16; - const MODE_OPT_OUT = 1; - const SKIP_CUSTOM_STEPS = 2; - const IGNORE_SKIP_STEPS_CONFIG = 4; + public const MODE_COMMAND = 16; + public const MODE_OPT_OUT = 1; + public const SKIP_CUSTOM_STEPS = 2; + public const IGNORE_SKIP_STEPS_CONFIG = 4; /** * @var bool diff --git a/src/Util/WpConfigSectionEditor.php b/src/Util/WpConfigSectionEditor.php index fb6ffa0..1f6c829 100644 --- a/src/Util/WpConfigSectionEditor.php +++ b/src/Util/WpConfigSectionEditor.php @@ -6,9 +6,9 @@ class WpConfigSectionEditor { - const APPEND = 1; - const PREPEND = -1; - const REPLACE = 0; + public const APPEND = 1; + public const PREPEND = -1; + public const REPLACE = 0; /** * @var Paths diff --git a/src/Util/WpVersion.php b/src/Util/WpVersion.php index 0847046..313b49b 100644 --- a/src/Util/WpVersion.php +++ b/src/Util/WpVersion.php @@ -21,8 +21,8 @@ */ class WpVersion { - const WP_PACKAGE_TYPE = 'wordpress-core'; - const MIN_WP_VERSION = '4.8'; + public const WP_PACKAGE_TYPE = 'wordpress-core'; + public const MIN_WP_VERSION = '4.8'; /** * @var PackageFinder