Skip to content

Lint fixes for AdminMessageHandlerFile#3068

Closed
sol-loup wants to merge 4 commits intomainfrom
sollipse-lintfixes-4-17
Closed

Lint fixes for AdminMessageHandlerFile#3068
sol-loup wants to merge 4 commits intomainfrom
sollipse-lintfixes-4-17

Conversation

@sol-loup
Copy link
Copy Markdown
Contributor

@sol-loup sol-loup commented Apr 18, 2025

Description

This pull request addresses code quality and linting issues in the AdminMessageHandler class. The main changes include:

  • Replacing all instances of sizeof() with count() for array size checks.
  • Fixing docblock formatting and capitalization.
  • Replacing logical operator or with ||.
  • Expanding inline control structures to full statements.
  • Improving multi-line function call formatting.
  • Adding a PHPCS ignore comment for the unused $_status parameter in the redirect method.

These changes are non-breaking and focus solely on code clarity, maintainability, and compliance with coding standards.

Type of change

  • Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
  • I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
  • I followed general Pull Request best practices.
  • I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
  • I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
  • I have updated or requested update to plugin documentations (if necessary).

Changelog entry

Refactor: Replace sizeof() with count() and fix PHPCS/linting issues in AdminMessageHandler.

Test Plan

  1. Automated Tests: Run all existing unit and integration tests to ensure no regressions.
  2. Manual QA:
    • Trigger admin messages, warnings, errors, and info notices in the WordPress admin.
    • Confirm that all messages display as expected.
    • Perform actions that cause redirects and verify that messages persist across requests.
    • Check that no new PHP warnings, errors, or PHPCS issues are introduced.
  3. Code Review: Ensure all changes are limited to syntax and style, with no logic or behavioral changes.

Screenshots

N/A (no UI changes)

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sol-loup has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sol-loup merged this pull request in a27761f.

mradmeta pushed a commit that referenced this pull request Apr 19, 2025
Summary:
## Description

This pull request addresses code quality and linting issues in the `AdminMessageHandler` class. The main changes include:
- Replacing all instances of `sizeof()` with `count()` for array size checks.
- Fixing docblock formatting and capitalization.
- Replacing logical operator `or` with `||`.
- Expanding inline control structures to full statements.
- Improving multi-line function call formatting.
- Adding a PHPCS ignore comment for the unused `$_status` parameter in the `redirect` method.

These changes are non-breaking and focus solely on code clarity, maintainability, and compliance with coding standards.

### Type of change

- Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

## Checklist

- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices.
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary).

## Changelog entry

Refactor: Replace `sizeof()` with `count()` and fix PHPCS/linting issues in AdminMessageHandler.

Pull Request resolved: #3068

Test Plan:
1. **Automated Tests**: Run all existing unit and integration tests to ensure no regressions.
2. **Manual QA**:
   - Trigger admin messages, warnings, errors, and info notices in the WordPress admin.
   - Confirm that all messages display as expected.
   - Perform actions that cause redirects and verify that messages persist across requests.
   - Check that no new PHP warnings, errors, or PHPCS issues are introduced.
3. **Code Review**: Ensure all changes are limited to syntax and style, with no logic or behavioral changes.

## Screenshots

N/A (no UI changes)

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/7036874680167270
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14636698867856809

Reviewed By: carterbuce

Differential Revision: D73227487

Pulled By: sol-loup

fbshipit-source-id: 18067b7913e273b3298fd878f4b65fa8a7d5600d
mradmeta pushed a commit to mradmeta/facebook-for-woocommerce that referenced this pull request Apr 22, 2025
Summary:
## Description

This pull request addresses code quality and linting issues in the `AdminMessageHandler` class. The main changes include:
- Replacing all instances of `sizeof()` with `count()` for array size checks.
- Fixing docblock formatting and capitalization.
- Replacing logical operator `or` with `||`.
- Expanding inline control structures to full statements.
- Improving multi-line function call formatting.
- Adding a PHPCS ignore comment for the unused `$_status` parameter in the `redirect` method.

These changes are non-breaking and focus solely on code clarity, maintainability, and compliance with coding standards.

### Type of change

- Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

## Checklist

- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices.
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary).

## Changelog entry

Refactor: Replace `sizeof()` with `count()` and fix PHPCS/linting issues in AdminMessageHandler.

Pull Request resolved: facebook#3068

Test Plan:
1. **Automated Tests**: Run all existing unit and integration tests to ensure no regressions.
2. **Manual QA**:
   - Trigger admin messages, warnings, errors, and info notices in the WordPress admin.
   - Confirm that all messages display as expected.
   - Perform actions that cause redirects and verify that messages persist across requests.
   - Check that no new PHP warnings, errors, or PHPCS issues are introduced.
3. **Code Review**: Ensure all changes are limited to syntax and style, with no logic or behavioral changes.

## Screenshots

N/A (no UI changes)

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/7036874680167270
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14636698867856809

Reviewed By: carterbuce

Differential Revision: D73227487

Pulled By: sol-loup

fbshipit-source-id: 18067b7913e273b3298fd878f4b65fa8a7d5600d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants