diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a823974afa..69ce9db24c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -82,4 +82,4 @@ jobs: run: composer install - name: PHPCS check - run: './vendor/bin/phpcs . -q --report=checkstyle --warning-severity=6 --runtime-set testVersion 7.4- | cs2pr' + run: './vendor/bin/phpcs . -q --report=checkstyle --runtime-set testVersion 7.4- | cs2pr' diff --git a/.stylelintrc b/.stylelintrc index f7007ae70b..3b8c4705a1 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -1,18 +1,17 @@ { - "extends": [ - "@10up/stylelint-config" - ], - "rules": { - "scale-unlimited/declaration-strict-value": [ - "/color/", - { - "ignoreValues": ["currentColor", "inherit", "initial", "transparent", "unset"], - "severity": "warning" - } - ], - "font-family-no-missing-generic-family-keyword": null, - "declaration-property-unit-allowed-list": null, - "at-rule-disallowed-list": null - } + "extends": [ + "@10up/stylelint-config" + ], + "rules": { + "scale-unlimited/declaration-strict-value": [ + "/color/", + { + "ignoreValues": ["currentcolor", "inherit", "initial", "transparent", "unset"], + "severity": "warning" + } + ], + "font-family-no-missing-generic-family-keyword": null, + "declaration-property-unit-allowed-list": null + } } diff --git a/assets/css/autosuggest.css b/assets/css/autosuggest.css index 636183860c..56d4a605f1 100644 --- a/assets/css/autosuggest.css +++ b/assets/css/autosuggest.css @@ -1,9 +1,11 @@ +@import "./global/colors.css"; + .ep-autosuggest-container { position: relative; & .ep-autosuggest { - background: #fff; - border: 1px solid #ccc; + background: var(--ep-c-white); + border: 1px solid var(--ep-c-white-gray); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); display: none; position: absolute; @@ -19,14 +21,14 @@ font-family: sans-serif; & > a.autosuggest-link { - color: #000; + color: var(--ep-c-black); cursor: pointer; display: block; padding: 2px 10px; &:hover, &:active { - background-color: #eee; + background-color: var(--ep-c-medium-white); text-decoration: none; } } @@ -35,7 +37,7 @@ } & .selected { - background-color: #eee; + background-color: var(--ep-c-medium-white); text-decoration: none; } } diff --git a/assets/css/dashboard.css b/assets/css/dashboard.css index 329f3a7c75..9ed56d97d7 100644 --- a/assets/css/dashboard.css +++ b/assets/css/dashboard.css @@ -1,10 +1,5 @@ @import "@10up/component-tooltip"; - -:root { - --ep-dashboard-status-ok: #6aa000; - --ep-dashboard-status-warning: #e3e600; - --ep-dashboard-status-error: #f00; -} +@import "./global/colors.css"; html.wp-toolbar { background: transparent; @@ -40,7 +35,7 @@ h2.ep-list-features { } .ep-header-menu { - background-color: #fff; + background-color: var(--ep-c-white); border-bottom: 2px solid #ddd; margin-left: -20px; padding-bottom: 5px; @@ -96,7 +91,7 @@ h2.ep-list-features { .ep-header-menu .sync-status { bottom: -1px; - color: #666; + color: var(--ep-c-medium-gray); display: none; font-style: italic; margin-right: 8px; @@ -105,7 +100,7 @@ h2.ep-list-features { } .ep-header-menu .progress-bar { - background-color: #d84440; + background-color: var(--ep-c-medium-red); bottom: 0; height: 5px; left: 0; @@ -132,7 +127,7 @@ h2.ep-list-features { .error-overlay.cant-connect, .error-overlay.syncing { - background-color: #fff; + background-color: var(--ep-c-white); bottom: 0; content: " "; display: block; @@ -163,7 +158,7 @@ h2.ep-list-features { } .ep-feature .postbox .hndle .settings-button { - background-color: #efefef; + background-color: var(--ep-c-medium-white); border: none; border-radius: 4px; color: inherit; @@ -180,7 +175,7 @@ h2.ep-list-features { } .ep-feature .settings-button::before { - color: #72777c; + color: var(--ep-c-medium-gray); content: "\f140"; display: inline-block; font: 400 19px/1 dashicons; @@ -206,11 +201,11 @@ h2.ep-list-features { & .postbox .hndle .settings-button::after { background-color: transparent; - border: 1px solid var(--ep-dashboard-status-error); + border: 1px solid var(--ep-status-error); } & .settings .requirements-status-notice { - border-color: var(--ep-dashboard-status-error); + border-color: var(--ep-status-error); } } @@ -218,15 +213,15 @@ h2.ep-list-features { & .postbox .hndle .settings-button::after { background-color: transparent; - border: 1px solid var(--ep-dashboard-status-warning); + border: 1px solid var(--ep-status-warning); } &.feature-active .postbox .hndle .settings-button::after { - background-color: var(--ep-dashboard-status-warning); + background-color: var(--ep-status-warning); } & .settings .requirements-status-notice { - border-color: var(--ep-dashboard-status-warning); + border-color: var(--ep-status-warning); } } @@ -234,15 +229,15 @@ h2.ep-list-features { & .postbox .hndle .settings-button::after { background-color: transparent; - border: 1px solid var(--ep-dashboard-status-ok); + border: 1px solid var(--ep-status-ok); } &.feature-active .postbox .hndle .settings-button::after { - background-color: var(--ep-dashboard-status-ok); + background-color: var(--ep-status-ok); } & .settings .requirements-status-notice { - border-color: var(--ep-dashboard-status-ok); + border-color: var(--ep-status-ok); } } @@ -254,11 +249,11 @@ h2.ep-list-features { .ep-feature.saving .action-wrap::before { animation: load8 1.1s infinite linear; - border-bottom: 5px solid #ccc; - border-left: 5px solid #999; + border-bottom: 5px solid var(--ep-c-white-gray); + border-left: 5px solid var(--ep-c-light-gray); border-radius: 50%; - border-right: 5px solid #ccc; - border-top: 5px solid #ccc; + border-right: 5px solid var(--ep-c-white-gray); + border-top: 5px solid var(--ep-c-white-gray); content: " "; display: inline-block; font-size: 7px; @@ -305,18 +300,18 @@ h2.ep-list-features { } .ep-feature .settings .requirements-status-notice { - background-color: #efefef; - border-left: 4px solid var(--ep-dashboard-status-ok); + background-color: var(--ep-c-medium-white); + border-left: 4px solid var(--ep-status-ok); margin-bottom: 10px; padding: 8px 12px; &.requirements-status-notice--reindex { - border-color: var(--ep-dashboard-status-warning); + border-color: var(--ep-status-warning); display: none; /* Controlled by JavaScript. */ } &.requirements-status-notice--syncing { - border-color: var(--ep-dashboard-status-error); + border-color: var(--ep-status-error); display: none; /* Controlled by JavaScript. */ } } @@ -333,7 +328,7 @@ h2.ep-list-features { } & .no-dash-sync { - color: #aaa; + color: var(--ep-c-light-gray); display: none; line-height: 27px; padding-right: 8px; @@ -387,14 +382,14 @@ h2.ep-list-features { } & .field-description { - color: #666; + color: var(--ep-c-medium-gray); font-style: italic; margin-bottom: 0; margin-top: 4px; } & .disabled { - color: #bbb; + color: var(--ep-c-light-gray); & input { cursor: default; @@ -410,7 +405,7 @@ h2.ep-list-features { } & .components-form-token-field__input-container { - border-color: #8c8f94; + border-color: var(--ep-c-light-gray); } } @@ -461,7 +456,7 @@ h2.ep-list-features { } .intro h1 { - color: #626262; + color: var(--ep-c-medium-gray); font-weight: 600; margin: 0.5em 0 2em; text-align: center; @@ -484,7 +479,7 @@ h2.ep-list-features { } & h2 { - color: #626262; + color: var(--ep-c-medium-gray); height: 8%; } @@ -576,9 +571,9 @@ h2.ep-list-features { } .ep-circle { - background: #fff; + background: var(--ep-c-white); border-radius: 50%; - color: #626262; + color: var(--ep-c-medium-gray); display: inline-block; font-size: 16px; font-weight: 400; @@ -616,8 +611,8 @@ h2.ep-list-features { } .ep-circle--active { - background-color: #d73c38; - color: #fff; + background-color: var(--ep-c-medium-red); + color: var(--ep-c-white); } .wrap.intro { @@ -644,11 +639,11 @@ h2.ep-list-features { .setup-button { -webkit-appearance: none; - background-color: #e63e3b; + background-color: var(--ep-c-medium-red); border: none; border-radius: 10px; box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.25); - color: #fff; + color: var(--ep-c-white); display: inline-block; margin: 0 0.75em; padding: 1em 1.5em; @@ -656,13 +651,13 @@ h2.ep-list-features { } .setup-button:hover { - background-color: #b93431; - color: #ffe8ed; + background-color: var(--ep-c-dark-red); + color: var(--ep-c-white-red); } .setup-message .setup-button-primary { - background-color: #fff; - color: #d84440; + background-color: var(--ep-c-white); + color: var(--ep-c-medium-red); } .ep-feature-search .wp-color-result.button { @@ -761,7 +756,7 @@ h2.ep-list-features { /* @media screen and (max-width: 600px) { */ .wrap h2.nav-tab-wrapper.ep-credentials-tabs { - border-bottom: 1px solid #ccc; + border-bottom: 1px solid var(--ep-c-white-gray); } /* } */ @@ -776,7 +771,7 @@ h2 .nav-tab.ep-credentials-tab { } .ep-credentials-tab.nav-tab-active { - border-bottom-color: #f1f1f1; + border-bottom-color: var(--ep-c-white); } .ep-credentials-tab img, @@ -786,15 +781,15 @@ h2 .nav-tab.ep-credentials-tab { } .ep-credentials fieldset { - border-bottom: 1px solid #ccc; - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; + border-bottom: 1px solid var(--ep-c-white-gray); + border-left: 1px solid var(--ep-c-white-gray); + border-right: 1px solid var(--ep-c-white-gray); margin: 0; padding: 0 1rem; } .ep-credentials fieldset.predefined { - border-top: 1px solid #ccc; + border-top: 1px solid var(--ep-c-white-gray); } .ep-settings .ep-credentials-general { @@ -859,14 +854,14 @@ h2 .nav-tab.ep-credentials-tab { } */ @media (--wide-min) { - background-color: #fff; + background-color: var(--ep-c-white); margin-right: 28px; width: 37%; } } .stats-queries { - background-color: #fff; + background-color: var(--ep-c-white); width: 100%; /* @media( --tablet-min ) { @@ -908,27 +903,27 @@ h2 .nav-tab.ep-credentials-tab { } .green-status { - color: var(--ep-dashboard-status-ok); + color: var(--ep-status-ok); } .yellow-status { - color: var(--ep-dashboard-status-warning); + color: var(--ep-status-warning); } .red-status { - color: var(--ep-dashboard-status-error); + color: var(--ep-status-error); } .green-status::after { - background-color: var(--ep-dashboard-status-ok); + background-color: var(--ep-status-ok); } .yellow-status::after { - background-color: var(--ep-dashboard-status-warning); + background-color: var(--ep-status-warning); } .red-status::after { - background-color: var(--ep-dashboard-status-error); + background-color: var(--ep-status-error); } .doc-chart { diff --git a/assets/css/facets.css b/assets/css/facets.css index 22a9f6e8ca..4ca5a25004 100644 --- a/assets/css/facets.css +++ b/assets/css/facets.css @@ -1,6 +1,6 @@ +@import "./global/colors.css"; + :root { - --ep-range-slider-background-color: #fff; - --ep-range-slider-track-color: #eee; @media ( min-width: 768px ) { --ep-range-slider-thumb-size: 1.25em; @@ -73,13 +73,13 @@ } & .term a:hover .ep-checkbox { - background-color: #ccc; + background-color: var(--ep-c-white-gray); } } .ep-checkbox { align-items: center; - background-color: #eee; + background-color: var(--ep-c-medium-white); display: flex; flex-shrink: 0; height: 1em; @@ -99,7 +99,7 @@ } .ep-checkbox.checked { - background-color: #5e5e5e; + background-color: var(--ep-c-medium-gray); } .ep-checkbox.checked::after { @@ -128,21 +128,21 @@ } .ep-range-slider__track { - background: var(--ep-range-slider-track-color); + background: var(--ep-c-medium-white); border-radius: calc(var(--ep-range-slider-track-size) / 2); height: var(--ep-range-slider-track-size); } .ep-range-slider__track-1 { - background-color: currentcolor; /* stylelint-disable-line scale-unlimited/declaration-strict-value */ + background-color: currentcolor; } .ep-range-slider__thumb { - background-color: currentcolor; /* stylelint-disable-line scale-unlimited/declaration-strict-value */ + background-color: currentcolor; border-radius: calc(var(--ep-range-slider-thumb-size) / 2); box-shadow: inset 0 0 0 calc(var(--ep-range-slider-thumb-size) / 10) currentcolor, - inset 0 0 0 calc((var(--ep-range-slider-thumb-size) - var(--ep-range-slider-track-size)) / 2) var(--ep-range-slider-background-color); + inset 0 0 0 calc((var(--ep-range-slider-thumb-size) - var(--ep-range-slider-track-size)) / 2) var(--ep-c-white); height: var(--ep-range-slider-thumb-size); width: var(--ep-range-slider-thumb-size); } @@ -155,7 +155,7 @@ & .ep-radio { appearance: none; - border: 1px solid #eee; + border: 1px solid var(--ep-c-medium-white); border-radius: 50%; height: 1em; margin-right: 0.25em; @@ -165,7 +165,7 @@ &:checked { background-color: transparent; - border: 5px solid #5e5e5e; + border: 5px solid var(--ep-c-medium-gray); &::after { opacity: 0; diff --git a/assets/css/global/colors.css b/assets/css/global/colors.css new file mode 100644 index 0000000000..66569fe649 --- /dev/null +++ b/assets/css/global/colors.css @@ -0,0 +1,27 @@ +/* + * Colors + */ +:root { + + /** + * Brand colors + */ + --ep-c-white: #fff; + --ep-c-medium-white: #eee; + --ep-c-white-gray: #ccc; + --ep-c-white-red: #ffe8ed; + --ep-c-white-yellow: #fdeeca; + --ep-c-medium-gray: #626262; + --ep-c-light-gray: #999; + --ep-c-black: #000; + --ep-c-medium-red: #d73c38; + --ep-c-dark-red: #b93431; + --ep-c-medium-dark-blue: #0073aa; + + /** + * Status colors + */ + --ep-status-ok: #6aa000; + --ep-status-warning: #e3e600; + --ep-status-error: #f00; +} diff --git a/assets/css/instant-results.css b/assets/css/instant-results.css index 25a110f9d6..0bf5317945 100644 --- a/assets/css/instant-results.css +++ b/assets/css/instant-results.css @@ -1,3 +1,4 @@ +@import "./global/colors.css"; @import "instant-results/utilities.css"; @import "instant-results/checkbox.css"; @import "instant-results/input.css"; @@ -17,8 +18,6 @@ @import "instant-results/toolbar.css"; :root { - --ep-search-background-color: #fff; - --ep-search-alternate-background-color: #efefef; --ep-search-border-color: #dfdfdf; --ep-search-range-thumb-size: 1.625em; --ep-search-range-track-size: 0.75em; diff --git a/assets/css/instant-results/modal.css b/assets/css/instant-results/modal.css index 081dfffc0a..f66631ae7d 100644 --- a/assets/css/instant-results/modal.css +++ b/assets/css/instant-results/modal.css @@ -13,19 +13,6 @@ top: 0; z-index: 9999; - @nest .rtl & { - direction: rtl; - text-align: right; - } - - @nest .admin-bar & { - top: 32px; - - @media ( max-width: 782px ) { - top: 46px; - } - } - &[aria-hidden="true"] { display: none; } @@ -35,8 +22,25 @@ } } +.rtl .ep-search-modal { + direction: rtl; + text-align: right; +} + +.admin-bar .ep-search-modal { + top: 32px; +} + +@media ( max-width: 782px ) { + + .admin-bar .ep-search-modal { + top: 46px; + } +} + + .ep-search-modal__content { - background-color: var(--ep-search-background-color); + background-color: var(--ep-c-white); bottom: 0; display: flex; flex-direction: column; diff --git a/assets/css/instant-results/pagination.css b/assets/css/instant-results/pagination.css index c0eb1b2bfa..3d69e61e13 100644 --- a/assets/css/instant-results/pagination.css +++ b/assets/css/instant-results/pagination.css @@ -4,10 +4,10 @@ grid-template-columns: 1fr 1fr 1fr; margin-top: auto; text-align: center; +} - @nest .rtl & { - direction: rtl; - } +.rtl .ep-search-pagination { + direction: rtl; } .ep-search-pagination__next { diff --git a/assets/css/instant-results/panel.css b/assets/css/instant-results/panel.css index cfa0620f19..32d5cfa82d 100644 --- a/assets/css/instant-results/panel.css +++ b/assets/css/instant-results/panel.css @@ -2,10 +2,10 @@ border: 1px solid var(--ep-search-border-color); margin: 0; padding: 0; +} - @nest .ep-search-panel + & { - border-top-width: 0; - } +.ep-search-panel + .ep-search-panel { + border-top-width: 0; } .ep-search-panel__heading { diff --git a/assets/css/instant-results/range-slider.css b/assets/css/instant-results/range-slider.css index 521fa79c96..cdc09d95c1 100644 --- a/assets/css/instant-results/range-slider.css +++ b/assets/css/instant-results/range-slider.css @@ -6,7 +6,7 @@ } .ep-search-range-slider__track { - background: var(--ep-search-alternate-background-color); + background: var(--ep-c-medium-white); border-radius: calc(var(--ep-search-range-track-size) / 2); height: var(--ep-search-range-track-size); } @@ -20,7 +20,7 @@ border-radius: calc(var(--ep-search-range-thumb-size) / 2); box-shadow: inset 0 0 0 calc(var(--ep-search-range-thumb-size) / 10) currentcolor, - inset 0 0 0 calc((var(--ep-search-range-thumb-size) - var(--ep-search-range-track-size)) / 2) var(--ep-search-background-color); + inset 0 0 0 calc((var(--ep-search-range-thumb-size) - var(--ep-search-range-track-size)) / 2) var(--ep-c-white); height: var(--ep-search-range-thumb-size); width: var(--ep-search-range-thumb-size); } diff --git a/assets/css/instant-results/result.css b/assets/css/instant-results/result.css index 333769be1a..d0081747a8 100644 --- a/assets/css/instant-results/result.css +++ b/assets/css/instant-results/result.css @@ -61,7 +61,7 @@ } .ep-search-result__type { - background-color: var(--ep-search-alternate-background-color); + background-color: var(--ep-c-medium-white); border-radius: 0.25em; display: inline-block; font-size: 0.875em; diff --git a/assets/css/instant-results/sort.css b/assets/css/instant-results/sort.css index be9e085b4c..264fd13385 100644 --- a/assets/css/instant-results/sort.css +++ b/assets/css/instant-results/sort.css @@ -2,23 +2,26 @@ flex-shrink: 0; gap: 0.5em; margin: 0; +} - @nest .ep-search-results & { - display: none; +.ep-search-sidebar .ep-search-sort { + display: flex; + flex-direction: column; + margin-bottom: 1em; +} - @media ( min-width: 768px ) { - align-items: center; - display: flex; - } - } +.ep-search-results .ep-search-sort { + display: none; +} + +@media ( min-width: 768px ) { - @nest .ep-search-sidebar & { + .ep-search-results .ep-search-sort { + align-items: center; display: flex; - flex-direction: column; - margin-bottom: 1em; + } - @media ( min-width: 768px ) { - display: none; - } + .ep-search-sidebar .ep-search-sort { + display: none; } } diff --git a/assets/css/instant-results/tokens.css b/assets/css/instant-results/tokens.css index a09d20f17a..8237f5b6b1 100644 --- a/assets/css/instant-results/tokens.css +++ b/assets/css/instant-results/tokens.css @@ -1,6 +1,3 @@ -.ep-search-tokens { - - @nest .ep-search-toolbar & { - display: contents; - } +.ep-search-toolbar .ep-search-tokens { + display: contents; } diff --git a/assets/css/ordering.css b/assets/css/ordering.css index db0814af3a..f6c3b7ccf5 100644 --- a/assets/css/ordering.css +++ b/assets/css/ordering.css @@ -1,9 +1,11 @@ +@import "./global/colors.css"; + #ep-ordering { border-left-width: 0; border-right-width: 0; & .inside { - background-color: #f1f1f1; + background-color: var(--ep-c-white); margin: 0; padding: 0; } @@ -11,13 +13,13 @@ & .pointers, & .pointer-search, & .loading { - background-color: #fff; - border-left: 1px solid #eee; - border-right: 1px solid #eee; + background-color: var(--ep-c-white); + border-left: 1px solid var(--ep-c-medium-white); + border-right: 1px solid var(--ep-c-medium-white); } & .new-post { - background: #fff; + background: var(--ep-c-white); padding: 0 1em; } @@ -32,9 +34,9 @@ } & .pointer-type { - border: 2px solid #0073aa; + border: 2px solid var(--ep-c-medium-dark-blue); border-radius: 2px; - color: #0073aa; + color: var(--ep-c-medium-dark-blue); display: inline-block; font-size: 0.75em; font-weight: 700; @@ -49,16 +51,16 @@ padding: 1em; &:nth-child(odd) { - background-color: #f9f9f9; + background-color: var(--ep-c-white); } } & .title { - color: #0073aa; + color: var(--ep-c-medium-dark-blue); } & .removed .title { - color: #999; + color: var(--ep-c-light-gray); } & .pointer-actions { @@ -74,15 +76,15 @@ } & .next-page-notice { - background-color: #fdeeca; + background-color: var(--ep-c-white-yellow); padding: 1em 0; text-align: center; } } & .legend { - background: #fff; - border-bottom: 1px solid #eee; + background: var(--ep-c-white); + border-bottom: 1px solid var(--ep-c-medium-white); padding: 1em 0; text-align: center; } @@ -102,8 +104,8 @@ } & .section-title { - border-bottom: 1px solid #eee; - border-top: 1px solid #eee; + border-bottom: 1px solid var(--ep-c-medium-white); + border-top: 1px solid var(--ep-c-medium-white); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); font-weight: 700; } @@ -135,7 +137,7 @@ } &:hover { - background-color: #f9f9f9; + background-color: var(--ep-c-white); } } } diff --git a/assets/css/woocommerce/admin/components/combobox.css b/assets/css/woocommerce/admin/components/combobox.css index fc3cbdd639..39bd1d7f7e 100644 --- a/assets/css/woocommerce/admin/components/combobox.css +++ b/assets/css/woocommerce/admin/components/combobox.css @@ -1,7 +1,5 @@ :root { - --ep-combobox-list-background: #fff; --ep-combobox-list-background-selected: #f5f5f5; - --ep-combobox-list-border: #8c8f94; } .ep-combobox { @@ -9,8 +7,8 @@ } .ep-combobox__list { - background-color: var(--ep-combobox-list-background); - border: 1px solid var(--ep-combobox-list-border); + background-color: var(--ep-c-white); + border: 1px solid var(--ep-c-light-gray); border-radius: 4px; box-shadow: 0 2px 6px rgb(0 0 0 / 5%); box-sizing: border-box; @@ -23,9 +21,10 @@ width: 100%; z-index: 1; - @nest .ep-combobox__input[aria-expanded="true"] ~ & { - display: block; - } +} + +.ep-combobox__input[aria-expanded="true"] ~ .ep-combobox__list { + display: block; } .ep-combobox__option { diff --git a/assets/css/woocommerce/admin/components/suggestion.css b/assets/css/woocommerce/admin/components/suggestion.css index bcf2ed9fc8..4700ba4dcf 100644 --- a/assets/css/woocommerce/admin/components/suggestion.css +++ b/assets/css/woocommerce/admin/components/suggestion.css @@ -10,10 +10,10 @@ display: block; font-size: small; font-weight: 600; +} - @nest [aria-selected="true"] & { - color: var(--wp-admin-theme-color); - } +[aria-selected="true"] .ep-suggestion__title { + color: var(--wp-admin-theme-color); } .ep-suggestion__footer { diff --git a/assets/css/woocommerce/admin/orders.css b/assets/css/woocommerce/admin/orders.css index 7e96809cd2..0493062a4a 100644 --- a/assets/css/woocommerce/admin/orders.css +++ b/assets/css/woocommerce/admin/orders.css @@ -1,3 +1,4 @@ +@import "../../global/colors.css"; @import "components/combobox.css"; @import "components/suggestion.css"; diff --git a/assets/js/api-search/src/utilities.js b/assets/js/api-search/src/utilities.js index 60b315b994..587020e4ff 100644 --- a/assets/js/api-search/src/utilities.js +++ b/assets/js/api-search/src/utilities.js @@ -135,9 +135,9 @@ export const getUrlParamsFromArgs = (args, schema, prefix = '') => { * @property {any} [default] Default arg value. * @property {Array} [allowedValues] Array of allowed values. * - * @param {Object} argsSchema Schema to build args from. + * @param {{[key: string]: ArgSchema}} argsSchema Schema to build args from. * @param {string} [paramPrefix] Parameter prefix. - * @returns {Object} Query args. + * @returns {{[key: string]: any}} Query args. */ export const getArgsFromUrlParams = (argsSchema, paramPrefix = '') => { const urlParams = new URLSearchParams(window.location.search); @@ -159,8 +159,8 @@ export const getArgsFromUrlParams = (argsSchema, paramPrefix = '') => { /** * Build request args from defaults provided in a given schema. * - * @param {Object} argsSchema Schema to build args from. - * @returns {Object} Query args. + * @param {{[key: string]: ArgSchema}} argsSchema Schema to build args from. + * @returns {{[key: string]: any}} Query args. */ export const getDefaultArgsFromSchema = (argsSchema) => { return Object.entries(argsSchema).reduce((args, [arg, schema]) => { diff --git a/assets/js/sync-ui/css/advanced-control.css b/assets/js/sync-ui/css/advanced-control.css index 4757c3abf9..bb89b51438 100644 --- a/assets/js/sync-ui/css/advanced-control.css +++ b/assets/js/sync-ui/css/advanced-control.css @@ -1,10 +1,6 @@ .ep-sync-advanced-control { margin-bottom: 24px; - @nest fieldset& { - margin-bottom: 16px; - } - &.components-flex .components-flex-item { flex-grow: 2; } @@ -14,6 +10,10 @@ } } +fieldset.ep-sync-advanced-control { + margin-bottom: 16px; +} + .ep-sync-advanced-control__label { display: inline-block; font-size: 11px; diff --git a/assets/js/sync-ui/css/progress-bar.css b/assets/js/sync-ui/css/progress-bar.css index cd30f368ff..9e3431d1a9 100644 --- a/assets/js/sync-ui/css/progress-bar.css +++ b/assets/js/sync-ui/css/progress-bar.css @@ -17,16 +17,16 @@ padding: 0 8px; transition: all 500ms ease-in-out; white-space: nowrap; +} - @nest .ep-sync-progress-bar--complete & { - background: var(--ep-sync-color-success); - } +.ep-sync-progress-bar--complete .ep-sync-progress-bar__progress { + background: var(--ep-sync-color-success); +} - @nest .ep-sync-progress-bar--paused & { - opacity: 0.5; - } +.ep-sync-progress-bar--paused .ep-sync-progress-bar__progress { + opacity: 0.5; +} - @nest .ep-sync-progress-bar--failed & { - background: var(--ep-sync-color-error); - } +.ep-sync-progress-bar--failed .ep-sync-progress-bar__progress { + background: var(--ep-sync-color-error); } diff --git a/assets/js/synonyms/css/list-table.css b/assets/js/synonyms/css/list-table.css index e9af067b42..f5f344499d 100644 --- a/assets/js/synonyms/css/list-table.css +++ b/assets/js/synonyms/css/list-table.css @@ -46,10 +46,10 @@ .ep-synonyms-list-table__primary-column { width: 25%; +} - @nest .ep-synonyms-list-table--replacements & { - width: auto; - } +.ep-synonyms-list-table--replacements .ep-synonyms-list-table__primary-column { + width: auto; } .ep-synonyms-list-table__actions-column { diff --git a/includes/classes/Command.php b/includes/classes/Command.php index 0ae7e9bcd8..873de8c194 100644 --- a/includes/classes/Command.php +++ b/includes/classes/Command.php @@ -1114,14 +1114,13 @@ private function maybe_change_host( $assoc_args ) { if ( isset( $assoc_args['ep-host'] ) ) { add_filter( 'ep_host', - function ( $host ) use ( $assoc_args ) { + function () use ( $assoc_args ) { return $assoc_args['ep-host']; } ); } } - /** * maybe change index prefix on the fly * @@ -1133,7 +1132,7 @@ private function maybe_change_index_prefix( $assoc_args ) { if ( isset( $assoc_args['ep-prefix'] ) ) { add_filter( 'ep_index_prefix', - function ( $prefix ) use ( $assoc_args ) { + function ( $prefix ) use ( $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found return $assoc_args['ep-prefix']; } ); diff --git a/includes/classes/Feature/Facets/Renderer.php b/includes/classes/Feature/Facets/Renderer.php index 03fec4ba30..c31c253031 100644 --- a/includes/classes/Feature/Facets/Renderer.php +++ b/includes/classes/Feature/Facets/Renderer.php @@ -72,7 +72,8 @@ protected function order_values( array $values, string $orderby = 'count', $orde * @param string $url URL for the facet item. * @return string|null */ - public function get_facet_item_value_html( $item, string $url ) { + public function get_facet_item_value_html( $item, string $url ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable return null; } } diff --git a/includes/classes/Feature/RelatedPosts/RelatedPosts.php b/includes/classes/Feature/RelatedPosts/RelatedPosts.php index e5c321c569..9ed6e8920f 100644 --- a/includes/classes/Feature/RelatedPosts/RelatedPosts.php +++ b/includes/classes/Feature/RelatedPosts/RelatedPosts.php @@ -122,14 +122,14 @@ public function formatted_args( $formatted_args, $args ) { * Search Elasticsearch for related content * * @param int $post_id Post ID - * @param int $return Return code + * @param int $post_return Number of posts to return * @since 4.1.0 * @return WP_Query */ - public function get_related_query( $post_id, $return = 5 ) { + public function get_related_query( $post_id, $post_return = 5 ) { $args = array( 'more_like' => $post_id, - 'posts_per_page' => $return, + 'posts_per_page' => $post_return, 'ep_integrate' => true, 'ignore_sticky_posts' => true, ); @@ -149,15 +149,15 @@ public function get_related_query( $post_id, $return = 5 ) { * Search Elasticsearch for related content * * @param int $post_id Post ID - * @param int $return Return code + * @param int $post_return Number of posts to return * * @since 2.1 * @uses get_related_query * * @return array|bool */ - public function find_related( $post_id, $return = 5 ) { - $query = $this->get_related_query( $post_id, $return ); + public function find_related( $post_id, $post_return = 5 ) { + $query = $this->get_related_query( $post_id, $post_return ); if ( ! $query->have_posts() ) { return false; diff --git a/includes/classes/Feature/Search/Weighting.php b/includes/classes/Feature/Search/Weighting.php index f7d582b9fc..2b34e62053 100644 --- a/includes/classes/Feature/Search/Weighting.php +++ b/includes/classes/Feature/Search/Weighting.php @@ -351,9 +351,10 @@ public function render_settings_page() { * @param string $post_type Current post type we're rendering * @param array $field Current field to render * @param array $current_values Current stored weighting values + * * @deprecated */ - public function render_settings_section( $post_type, $field, $current_values ) { + public function render_settings_section( $post_type, $field, $current_values ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed _doing_it_wrong( __METHOD__, esc_html( 'Weighting sections display are now handled via React components.' ), @@ -381,7 +382,7 @@ public function handle_save() { * @param string $redirect_url Redirect URL. * @deprecated */ - protected function redirect( $redirect_url ) { + protected function redirect( $redirect_url ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.Found _doing_it_wrong( __METHOD__, esc_html( 'Weighting settings are now updated using the REST API, and do not redirect server-side.' ), @@ -397,7 +398,7 @@ protected function redirect( $redirect_url ) { * @since 3.4.1 * @deprecated */ - public function save_weighting_configuration( $settings ) { + public function save_weighting_configuration( $settings ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.Found _doing_it_wrong( __METHOD__, esc_html( 'Weighting sections display are now handled via React components.' ), diff --git a/includes/classes/Feature/WooCommerce/OrdersAutosuggest.php b/includes/classes/Feature/WooCommerce/OrdersAutosuggest.php index ef2c9036a4..f38ca3f9dc 100644 --- a/includes/classes/Feature/WooCommerce/OrdersAutosuggest.php +++ b/includes/classes/Feature/WooCommerce/OrdersAutosuggest.php @@ -312,7 +312,7 @@ public function get_search_template() { add_filter( 'ep_bypass_exclusion_from_search', '__return_true', 10 ); add_filter( 'ep_intercept_remote_request', '__return_true' ); - add_filter( 'ep_do_intercept_request', [ $this, 'intercept_search_request' ], 10, 4 ); + add_filter( 'ep_do_intercept_request', [ $this, 'intercept_search_request' ], 10, 3 ); add_filter( 'ep_is_integrated_request', [ $this, 'is_integrated_request' ], 10, 2 ); $query = new \WP_Query( @@ -363,10 +363,9 @@ public function is_integrated_request( $is_integrated, $context ) { * @param object $response Response * @param array $query Query * @param array $args WP_Query argument array - * @param int $failures Count of failures in request loop * @return object $response Response */ - public function intercept_search_request( $response, $query = [], $args = [], $failures = 0 ) { + public function intercept_search_request( $response, $query = [], $args = [] ) { $this->search_template = $query['args']['body']; return wp_remote_request( $query['url'], $args ); diff --git a/includes/classes/IndexHelper.php b/includes/classes/IndexHelper.php index ffc761b582..143dee551e 100644 --- a/includes/classes/IndexHelper.php +++ b/includes/classes/IndexHelper.php @@ -1168,21 +1168,21 @@ public function get_last_sync(): array { * We used to have two different filters for this (one for the dashboard, another for CLI), * this method combines both. * - * @param {stdClass} $object Object to be checked + * @param {stdClass} $indexable_object Object to be checked * @param {Indexable} $indexable Indexable * @return boolean */ - protected function should_skip_object_index( $object, $indexable ) { + protected function should_skip_object_index( $indexable_object, $indexable ) { /** * Filter whether to not sync specific item in dashboard or not * * @since 2.1 * @hook ep_item_sync_kill * @param {boolean} $kill False means dont sync - * @param {array} $object Object to sync + * @param {array} $indexable_object Object to sync * @return {Indexable} Indexable that object belongs to */ - $ep_item_sync_kill = apply_filters( 'ep_item_sync_kill', false, $object, $indexable ); + $ep_item_sync_kill = apply_filters( 'ep_item_sync_kill', false, $indexable_object, $indexable ); /** * Conditionally kill indexing for a post @@ -1192,7 +1192,7 @@ protected function should_skip_object_index( $object, $indexable ) { * @param {int} $object_id Object ID * @return {bool} New value */ - $ep_indexable_sync_kill = apply_filters( 'ep_' . $indexable->slug . '_index_kill', false, $object->ID ); + $ep_indexable_sync_kill = apply_filters( 'ep_' . $indexable->slug . '_index_kill', false, $indexable_object->ID ); return $ep_item_sync_kill || $ep_indexable_sync_kill; } diff --git a/includes/classes/Indexable/Post/QueryIntegration.php b/includes/classes/Indexable/Post/QueryIntegration.php index 06d78c9781..846bb8187e 100644 --- a/includes/classes/Indexable/Post/QueryIntegration.php +++ b/includes/classes/Indexable/Post/QueryIntegration.php @@ -64,7 +64,7 @@ public function __construct( $indexable_slug = 'post' ) { add_filter( 'posts_pre_query', array( $this, 'get_es_posts' ), 10, 2 ); // Properly restore blog if necessary - add_action( 'loop_end', array( $this, 'maybe_restore_blog' ), 10, 1 ); + add_action( 'loop_end', array( $this, 'maybe_restore_blog' ), 10 ); // Properly switch to blog if necessary add_action( 'the_post', array( $this, 'maybe_switch_to_blog' ), 10, 2 ); @@ -194,10 +194,11 @@ public function maybe_switch_to_blog( $post, $query = null ) { /** * Make sure the correct blog is restored * - * @param WP_Query $query WP_Query instance + * @param WP_Query $query WP_Query instance + * * @since 0.9 */ - public function maybe_restore_blog( $query ) { + public function maybe_restore_blog( $query ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found if ( ! is_multisite() ) { // @codeCoverageIgnoreStart return; diff --git a/includes/classes/Indexables.php b/includes/classes/Indexables.php index a2011c616a..c405f1edc3 100644 --- a/includes/classes/Indexables.php +++ b/includes/classes/Indexables.php @@ -118,24 +118,24 @@ public function is_active( string $slug ): bool { /** * Get all indexable instances * - * @param boolean $global If true or false, will only get Indexables with that global property. + * @param boolean $global_property If true or false, will only get Indexables with that global property. * @param boolean $slug_only True returns an array of only string slugs. * @param string $status Whether to return active indexables or all registered. * @since 3.0, 4.5.0 Added $status * @return array */ - public function get_all( $global = null, $slug_only = false, $status = 'active' ) { + public function get_all( $global_property = null, $slug_only = false, $status = 'active' ) { $indexables = []; $list = ( 'active' === $status ) ? $this->active_indexables : $this->registered_indexables; foreach ( $list as $slug => $indexable ) { - if ( null === $global ) { + if ( null === $global_property ) { if ( $slug_only ) { $indexables[] = $slug; } else { $indexables[] = $indexable; } - } elseif ( $global === $indexable->global ) { + } elseif ( $global_property === $indexable->global ) { if ( $slug_only ) { $indexables[] = $slug; } else { diff --git a/includes/classes/Installer.php b/includes/classes/Installer.php index c5a54bb4f5..c62235059d 100644 --- a/includes/classes/Installer.php +++ b/includes/classes/Installer.php @@ -33,18 +33,17 @@ class Installer { */ public function setup() { add_action( 'admin_init', [ $this, 'calculate_install_status' ], 9 ); - add_filter( 'admin_title', [ $this, 'filter_admin_title' ], 10, 2 ); + add_filter( 'admin_title', [ $this, 'filter_admin_title' ], 10 ); } /** * Filter admin title for install page * * @param string $admin_title Current title - * @param string $title Original title * @since 3.0 * @return string */ - public function filter_admin_title( $admin_title, $title ) { + public function filter_admin_title( $admin_title ) { if ( 'install' === Screen::factory()->get_current_screen() ) { // translators: Site Name return sprintf( esc_html__( 'ElasticPress Setup ‹ %s — WordPress', 'elasticpress' ), esc_html( get_bloginfo( 'name' ) ) ); diff --git a/includes/classes/REST/MetaKeys.php b/includes/classes/REST/MetaKeys.php index ae75cd595a..f7c8d56f40 100644 --- a/includes/classes/REST/MetaKeys.php +++ b/includes/classes/REST/MetaKeys.php @@ -50,10 +50,9 @@ public function check_permission() { /** * Get indexed meta keys. * - * @param \WP_REST_Request $request Full details about the request. * @return array */ - public function get_meta_keys( \WP_REST_Request $request ) { + public function get_meta_keys() { $post_indexable = Indexables::factory()->get( 'post' ); try { diff --git a/includes/classes/REST/Sync.php b/includes/classes/REST/Sync.php index 41280bdddc..7c16fe0fbe 100644 --- a/includes/classes/REST/Sync.php +++ b/includes/classes/REST/Sync.php @@ -177,10 +177,9 @@ public function output( array $message ) { /** * Get the status of a sync in progress. * - * @param \WP_REST_Request $request Full details about the request. * @return void */ - public function get_sync_status( \WP_REST_Request $request ) { + public function get_sync_status() { nocache_headers(); $index_meta = Utils\get_indexing_status(); @@ -211,10 +210,9 @@ public function get_sync_status( \WP_REST_Request $request ) { /** * Cancel a sync in progress. * - * @param \WP_REST_Request $request Full details about the request. * @return void */ - public function cancel_sync( \WP_REST_Request $request ) { + public function cancel_sync() { nocache_headers(); $index_meta = Utils\get_indexing_status(); diff --git a/includes/classes/REST/Taxonomies.php b/includes/classes/REST/Taxonomies.php index 582cccb333..92caf0af73 100644 --- a/includes/classes/REST/Taxonomies.php +++ b/includes/classes/REST/Taxonomies.php @@ -49,10 +49,9 @@ public function check_permission() { /** * Get filterable taxonomies. * - * @param \WP_REST_Request $request Full details about the request. * @return array */ - public function get_taxonomies( \WP_REST_Request $request ) { + public function get_taxonomies() { $filterable_taxonomies = Features::factory()->get_registered_feature( 'facets' )->types['taxonomy']->get_facetable_taxonomies(); $taxonomies = []; diff --git a/includes/classes/REST/Token.php b/includes/classes/REST/Token.php index a999de8de6..3afe88bf73 100644 --- a/includes/classes/REST/Token.php +++ b/includes/classes/REST/Token.php @@ -81,10 +81,9 @@ public function get_token( \WP_REST_Request $request ) { /** * Refresh the temporary token. * - * @param \WP_REST_Request $request Full details about the request. * @return string|false */ - public function refresh_token( \WP_REST_Request $request ) { + public function refresh_token() { $user_id = get_current_user_id(); $endpoint = $this->get_token_endpoint(); diff --git a/includes/compat.php b/includes/compat.php index 173db48b06..4fa0ce9437 100644 --- a/includes/compat.php +++ b/includes/compat.php @@ -51,16 +51,16 @@ public function __construct( $code, $message = null ) { * Search Elasticsearch for related content * * @param int $post_id Post ID - * @param int $return Number of posts to get + * @param int $post_return Number of posts to get * @since 2.1 * @return array|bool */ -function ep_find_related( $post_id, $return = 5 ) { +function ep_find_related( $post_id, $post_return = 5 ) { _deprecated_function( __FUNCTION__, '3.0', 'ElasticPress\Features::factory()->get_registered_feature' ); $feature = \ElasticPress\Features::factory()->get_registered_feature( 'related_posts' ); - return ( ! empty( $feature ) ) ? $feature->find_related( $post_id, $return ) : false; + return ( ! empty( $feature ) ) ? $feature->find_related( $post_id, $post_return ) : false; } /** diff --git a/tests/php/features/TestAutosuggest.php b/tests/php/features/TestAutosuggest.php index e4501dad41..66775d0278 100644 --- a/tests/php/features/TestAutosuggest.php +++ b/tests/php/features/TestAutosuggest.php @@ -347,7 +347,7 @@ public function test_autosuggest_ngram_fields_for_ajax_request() { add_filter( 'ep_query_request_path', - function ( $path, $index, $type, $query, $query_args, $query_object ) { + function ( $path, $index, $type, $query ) { $fields = $query['query']['function_score']['query']['bool']['should'][0]['bool']['must'][0]['bool']['should'][1]['multi_match']['fields']; $this->assertContains( 'term_suggest^1', $fields ); @@ -355,7 +355,7 @@ function ( $path, $index, $type, $query, $query_args, $query_object ) { return $path; }, 10, - 6 + 4 ); $query = new \WP_Query( @@ -399,7 +399,7 @@ public function test_autosuggest_ngram_fields_for_ajax_request_negative() { add_filter( 'ep_query_request_path', - function ( $path, $index, $type, $query, $query_args, $query_object ) { + function ( $path, $index, $type, $query ) { $fields = $query['query']['function_score']['query']['bool']['should'][0]['bool']['must'][0]['bool']['should'][1]['multi_match']['fields']; $this->assertNotContains( 'term_suggest^1', $fields ); @@ -407,7 +407,7 @@ function ( $path, $index, $type, $query, $query_args, $query_object ) { return $path; }, 10, - 6 + 4 ); $query = new \WP_Query( @@ -449,12 +449,12 @@ public function test_fuziness_with_type_auto_set_for_ajax_call() { add_filter( 'ep_query_request_path', - function ( $path, $index, $type, $query, $query_args, $query_object ) { + function ( $path, $index, $type, $query ) { $this->assertEquals( 'auto', $query['query']['function_score']['query']['bool']['should'][2]['multi_match']['fuzziness'] ); return $path; }, 10, - 6 + 4 ); $query = new \WP_Query( @@ -500,12 +500,12 @@ public function test_fuziness_with_type_auto_set_for_ajax_call_negative() { add_filter( 'ep_query_request_path', - function ( $path, $index, $type, $query, $query_args, $query_object ) { + function ( $path, $index, $type, $query ) { $this->assertNotEquals( 'auto', $query['query']['function_score']['query']['bool']['should'][2]['multi_match']['fuzziness'] ); return $path; }, 10, - 6 + 4 ); $query = new \WP_Query( diff --git a/tests/php/features/TestDidYouMean.php b/tests/php/features/TestDidYouMean.php index ff30159242..d514f99082 100644 --- a/tests/php/features/TestDidYouMean.php +++ b/tests/php/features/TestDidYouMean.php @@ -252,12 +252,12 @@ function () use ( $search_analyzer ) { add_filter( 'ep_query_request_args', - function ( $request_args, $path, $index, $type, $query, $query_args, $query_object ) use ( $search_analyzer ) { + function ( $request_args, $path, $index, $type, $query ) use ( $search_analyzer ) { $this->assertEquals( $search_analyzer, $query['suggest']['ep_suggestion'] ); return $request_args; }, 10, - 7 + 5 ); $query = new \WP_Query( diff --git a/tests/php/features/TestFacetTypeDate.php b/tests/php/features/TestFacetTypeDate.php index 637ff7c26b..d2a95c1d6a 100644 --- a/tests/php/features/TestFacetTypeDate.php +++ b/tests/php/features/TestFacetTypeDate.php @@ -254,7 +254,7 @@ public function testGetFacetOptions() { ], ]; - $change_filter_type = function ( $options ) use ( $modified_options ) { + $change_filter_type = function ( $options ) use ( $modified_options ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found return $modified_options; }; diff --git a/tests/php/features/TestFacetTypeMeta.php b/tests/php/features/TestFacetTypeMeta.php index a82ae8f644..93f2f25593 100644 --- a/tests/php/features/TestFacetTypeMeta.php +++ b/tests/php/features/TestFacetTypeMeta.php @@ -365,9 +365,9 @@ public function testGetSanitizeCallback() { $expected_result = sanitize_text_field( $test_meta ); $this->assertArrayHasKey( $expected_result, $selected['meta']['new_meta_key_1']['terms'] ); - $sanitize_function = function ( $function ) { + $sanitize_function = function ( $callback ) { - $this->assertSame( 'sanitize_text_field', $function ); + $this->assertSame( 'sanitize_text_field', $callback ); return 'sanitize_title'; }; diff --git a/tests/php/features/TestFacetTypeTaxonomy.php b/tests/php/features/TestFacetTypeTaxonomy.php index e7a626d901..4292d5fc5a 100644 --- a/tests/php/features/TestFacetTypeTaxonomy.php +++ b/tests/php/features/TestFacetTypeTaxonomy.php @@ -219,9 +219,9 @@ public function testGetSanitizeCallback() { $expected_result = sanitize_title( $test_taxonomy ); $this->assertArrayHasKey( $expected_result, $selected['taxonomies']['taxonomy']['terms'] ); - $sanitize_function = function ( $function ) { + $sanitize_function = function ( $callback ) { - $this->assertSame( 'sanitize_title', $function ); + $this->assertSame( 'sanitize_title', $callback ); return 'sanitize_text_field'; }; diff --git a/tests/php/features/WooCommerce/TestWooCommerceProduct.php b/tests/php/features/WooCommerce/TestWooCommerceProduct.php index b2c9eb170f..ce991468bf 100644 --- a/tests/php/features/WooCommerce/TestWooCommerceProduct.php +++ b/tests/php/features/WooCommerce/TestWooCommerceProduct.php @@ -439,7 +439,7 @@ public function testProductListInAdminUseElasticSearch() { add_filter( 'ep_post_filters', - function ( $filters, $args, $query ) { + function ( $filters ) { $expected_result = array( 'terms' => array( 'post_type.raw' => array( @@ -452,7 +452,6 @@ function ( $filters, $args, $query ) { return $filters; }, 10, - 3 ); parse_str( 'post_type=product&s=product', $_GET ); @@ -487,7 +486,7 @@ public function testProductListSearchInAdminUseElasticSearch() { add_filter( 'ep_post_formatted_args', - function ( $formatted_args, $args, $wp_query ) { + function ( $formatted_args, ) { $this->assertEquals( 'findme', $formatted_args['query']['function_score']['query']['bool']['should'][0]['multi_match']['query'] ); $this->assertEquals( $args['search_fields'], @@ -504,8 +503,7 @@ function ( $formatted_args, $args, $wp_query ) { return $formatted_args; }, - 10, - 3 + 10 ); parse_str( 'post_type=product&s=findme', $_GET ); diff --git a/tests/php/includes/classes/mock/class-wp-cli.php b/tests/php/includes/classes/mock/class-wp-cli.php index b4e0c48a95..64a1c971d0 100644 --- a/tests/php/includes/classes/mock/class-wp-cli.php +++ b/tests/php/includes/classes/mock/class-wp-cli.php @@ -34,10 +34,9 @@ public static function success( $message ) { /** * Display debug message. * - * @param string $message Message to display to the end user. - * @param boolean $group Group + * @param string $message Message to display to the end user. */ - public static function debug( $message, $group = false ) { + public static function debug( $message ) { print $message; } @@ -54,13 +53,13 @@ public static function warning( $message ) { * Display error message. * * @param string $message Message to display to the end user. - * @param boolean $exit Whether exit or not. + * @param boolean $should_exit Whether exit or not. * @return void * @throws Exception Exception */ - public static function error( $message, $exit = true ) { + public static function error( $message, $should_exit = true ) { - if ( ! $exit ) { + if ( ! $should_exit ) { print $message; return; } diff --git a/tests/php/includes/wp-cli-utils.php b/tests/php/includes/wp-cli-utils.php index 40693f7008..02bfd05e0d 100644 --- a/tests/php/includes/wp-cli-utils.php +++ b/tests/php/includes/wp-cli-utils.php @@ -19,9 +19,9 @@ * * @param array $assoc_args Arguments array. * @param string $flag Flag to get the value. - * @param mixed $default Default value for the flag. Default: NULL + * @param mixed $default_value Default value for the flag. Default: NULL * @return mixed */ -function get_flag_value( $assoc_args, $flag, $default = null ) { - return isset( $assoc_args[ $flag ] ) ? $assoc_args[ $flag ] : $default; +function get_flag_value( $assoc_args, $flag, $default_value = null ) { + return isset( $assoc_args[ $flag ] ) ? $assoc_args[ $flag ] : $default_value; } diff --git a/tests/php/indexables/TestPost.php b/tests/php/indexables/TestPost.php index b6c16fedde..ebfbda75b7 100644 --- a/tests/php/indexables/TestPost.php +++ b/tests/php/indexables/TestPost.php @@ -3827,11 +3827,11 @@ public function testAutoDraftPostStatus() { * * @param array|WP_Error $response HTTP response or WP_Error object. * @param string $type Context under which the hook is fired. - * @param string $class HTTP transport used. + * @param string $http_class HTTP transport used. * @param array $args HTTP request arguments. * @param string $url The request URL. */ - public function check404( $response, $type, $class, $args, $url ) { + public function check404( $response, $type, $http_class, $args, $url ) { $response_code = $response['response']['code']; if ( 404 === $response_code ) { $this->is_404 = true; @@ -8320,7 +8320,7 @@ public function testHighlightTagsWithCustomClass() { add_filter( 'ep_highlighting_class', - function ( $class ) { + function ( $highlight_class ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found return 'my-custom-class'; } ); @@ -8358,7 +8358,7 @@ public function testHighlightTagsOnlyForTitle() { add_filter( 'ep_highlighting_fields', - function ( $fields ) { + function ( $fields ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found return array( 'post_title' ); } ); @@ -8434,14 +8434,14 @@ public function testHighlightTagsNotSetWhenSearchIsEmpty() { add_action( 'pre_http_request', - function ( $preempt, $parsed_args, $url ) { + function ( $preempt, $parsed_args ) { $body = json_decode( $parsed_args['body'], true ); $this->assertArrayNotHasKey( 'highlight', $body ); return $preempt; }, 10, - 3 + 2 ); $args = array( diff --git a/tests/php/screen/TestStatusReport.php b/tests/php/screen/TestStatusReport.php index cebc284d67..4049a69eab 100644 --- a/tests/php/screen/TestStatusReport.php +++ b/tests/php/screen/TestStatusReport.php @@ -60,7 +60,7 @@ public function testGetReportsFilter() { public function testGetReportsSkipped() { $status_report = new StatusReport(); - parse_str( 'ep-skip-reports[]=wordpress&ep-skip-reports[]=indexable', $_GET ); // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled + parse_str( 'ep-skip-reports[]=wordpress&ep-skip-reports[]=indexable', $_GET ); // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText $reports = $status_report->get_reports(); $this->assertSame(