Skip to content

Modernize codebase (v2.x) and QA#22

Open
gmazzap wants to merge 1 commit into2.xfrom
modernize-2x
Open

Modernize codebase (v2.x) and QA#22
gmazzap wants to merge 1 commit into2.xfrom
modernize-2x

Conversation

@gmazzap
Copy link
Contributor

@gmazzap gmazzap commented May 20, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • [x Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Maintenance.

What is the current behavior? (You can also link to an open issue here)

N/A

What is the new behavior (if this is a feature change)?

No new behavior.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No.

Other information:

  • Require PHP 7.4+ and WP 5.5+ (so we can rely on wp_get_environment_type())
  • Update all dependencies' requirements
  • Update code to be compliant with the latest coding standards and Psalm
  • Deprecate "Spaces" hosting

- Require PHP 7.4+ and WP 5.5+ (so we can rely on wp_get_environment_type())
- Update all dependencies' requirements
- Update code to be compliant with latest coding standards and Psalm
- Deprecate "Spaces" hosting
@gmazzap gmazzap requested a review from Chrico May 20, 2024 16:40
@gmazzap gmazzap changed the base branch from master to 2.x May 20, 2024 16:40
Comment on lines -21 to -36
private const ENV_ALIASES = [
'local' => self::LOCAL,
'development' => self::DEVELOPMENT,
'dev' => self::DEVELOPMENT,
'develop' => self::DEVELOPMENT,
'staging' => self::STAGING,
'stage' => self::STAGING,
'preprod' => self::STAGING,
'pre-prod' => self::STAGING,
'pre-production' => self::STAGING,
'test' => self::STAGING,
'uat' => self::STAGING,
'production' => self::PRODUCTION,
'prod' => self::PRODUCTION,
'live' => self::PRODUCTION,
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was replaced by using wp_get_environmen_type(). Will this affect current systems which are using the non-defined WordPress env types (local, development, staging, production)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replaced code was still reducing the env names to the one supported by WP. Because after being obtained, the environment was "normalized" to one of the class constants which are exactly the values returned by wp_get_environmen_type().

Moreover, if you were using a WP version that has wp_get_environment_type() available (and considering that's 5.5+ chances are you are) the class was already using wp_get_environment_type().

In short, this change is just removing a good amount of complexity that was there just to account for WP < 5.5, which we don't want to care anymore...

Copy link
Member

@Chrico Chrico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me so far. Only have 1 question regarding the replacment of our ENV_ALIAS with the wp_get_enviornment_type() core function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants