diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 00000000..62f460be --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,36 @@ +name: PHP Checks + +on: + push: + branches: [ "trunk" ] + pull_request: + branches: [ "trunk" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run PHPCS + run: composer lint diff --git a/.lintstagedrc.json b/.lintstagedrc.json index b96bb4cc..9f5a556d 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -9,6 +9,6 @@ "10up-toolkit lint-js" ], "*.php": [ - "./vendor/bin/phpcs --extensions=php --warning-severity=8 -s" + "./vendor/bin/phpcs" ] } diff --git a/composer.json b/composer.json index 409ffe62..83f8c9e2 100755 --- a/composer.json +++ b/composer.json @@ -1,5 +1,7 @@ { "name": "10up/wp-scaffold", + "description": "The starting point for all 10up WordPress projects.", + "license": "MIT", "authors": [ { "name": "10up", @@ -22,10 +24,11 @@ "minimum-stability": "dev", "prefer-stable": true, "require-dev": { - "10up/phpcs-composer": "dev-master", + "10up/phpcs-composer": "^3.0", "wpackagist-plugin/debug-bar": "*", "wpackagist-plugin/query-monitor":"*", - "wpackagist-plugin/debug-bar-slow-actions":"*" + "wpackagist-plugin/debug-bar-slow-actions":"*", + "phpcompatibility/php-compatibility": "dev-develop as 9.99.99" }, "scripts": { "lint": "phpcs .", @@ -37,5 +40,11 @@ "type:wordpress-plugin" ] } + }, + "config": { + "allow-plugins": { + "composer/installers": true, + "dealerdirect/phpcodesniffer-composer-installer": true + } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index bca03768..029dc7df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,31 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5da80e9eca82f32aeaf13dee7f6a62fd", + "content-hash": "ce22954e5f3b831a4d40936f26ab1d5a", "packages": [], "packages-dev": [ { "name": "10up/phpcs-composer", - "version": "dev-master", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/10up/phpcs-composer.git", - "reference": "4a2f47d5ed0493836ef33ee2edad32192699fad6" + "reference": "04fe5f0d61948f9e38e9cd037a5ee50dcdbf4688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/10up/phpcs-composer/zipball/4a2f47d5ed0493836ef33ee2edad32192699fad6", - "reference": "4a2f47d5ed0493836ef33ee2edad32192699fad6", + "url": "https://api.github.com/repos/10up/phpcs-composer/zipball/04fe5f0d61948f9e38e9cd037a5ee50dcdbf4688", + "reference": "04fe5f0d61948f9e38e9cd037a5ee50dcdbf4688", "shasum": "" }, "require": { - "automattic/vipwpcs": "^2.3", + "automattic/vipwpcs": "^3.0", + "phpcompatibility/phpcompatibility-wp": "^2" + }, + "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "*", - "phpcompatibility/phpcompatibility-wp": "^2", - "squizlabs/php_codesniffer": "3.7.1", - "wp-coding-standards/wpcs": "*" + "phpcompatibility/php-compatibility": "dev-develop as 9.99.99" }, - "default-branch": true, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -43,30 +43,31 @@ "description": "10up's PHP CodeSniffer Ruleset", "support": { "issues": "https://github.com/10up/phpcs-composer/issues", - "source": "https://github.com/10up/phpcs-composer/tree/2.0.1" + "source": "https://github.com/10up/phpcs-composer/tree/3.0.0" }, - "time": "2023-09-14T12:16:59+00:00" + "time": "2023-12-14T15:37:22+00:00" }, { "name": "automattic/vipwpcs", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6" + "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", - "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", + "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", "sirbrillig/phpcs-variable-analysis": "^2.11.17", - "squizlabs/php_codesniffer": "^3.7.1", - "wp-coding-standards/wpcs": "^2.3" + "squizlabs/php_codesniffer": "^3.7.2", + "wp-coding-standards/wpcs": "^3.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", @@ -98,7 +99,7 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2023-08-24T15:11:13+00:00" + "time": "2023-09-05T11:01:05+00:00" }, { "name": "composer/installers", @@ -325,33 +326,45 @@ }, { "name": "phpcompatibility/php-compatibility", - "version": "9.3.5", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + "reference": "a8d67148fb990fbf5c2f6166d54bc91cc01fc655" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/a8d67148fb990fbf5c2f6166d54bc91cc01fc655", + "reference": "a8d67148fb990fbf5c2f6166d54bc91cc01fc655", "shasum": "" }, "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" }, - "conflict": { - "squizlabs/php_codesniffer": "2.6.2" + "replace": { + "wimg/php-compatibility": "*" }, "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.3", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4 || ^10.1.0", + "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, + "default-branch": true, "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "9.x-dev", + "dev-develop": "10.x-dev" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "LGPL-3.0-or-later" @@ -377,13 +390,29 @@ "keywords": [ "compatibility", "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibility/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibility" }, - "time": "2019-12-27T09:44:58+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-03-18T04:58:26+00:00" }, { "name": "phpcompatibility/phpcompatibility-paragonie", @@ -497,6 +526,172 @@ }, "time": "2022-10-24T09:00:36+00:00" }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.10", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "51609a5b89f928e0c463d6df80eb38eff1eaf544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/51609a5b89f928e0c463d6df80eb38eff1eaf544", + "reference": "51609a5b89f928e0c463d6df80eb38eff1eaf544", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.9.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-03-17T23:44:50+00:00" + }, { "name": "sirbrillig/phpcs-variable-analysis", "version": "v2.11.17", @@ -557,16 +752,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -576,11 +771,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -595,19 +790,29 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, "funding": [ { @@ -623,34 +828,42 @@ "type": "open_collective" } ], - "time": "2022-06-18T07:21:10+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -667,6 +880,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -674,7 +888,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-14T07:06:09+00:00" }, { "name": "wpackagist-plugin/debug-bar", @@ -731,10 +951,17 @@ "homepage": "https://wordpress.org/plugins/query-monitor/" } ], - "aliases": [], + "aliases": [ + { + "package": "phpcompatibility/php-compatibility", + "version": "dev-develop", + "alias": "9.99.99", + "alias_normalized": "9.99.99.0" + } + ], "minimum-stability": "dev", "stability-flags": { - "10up/phpcs-composer": 20 + "phpcompatibility/php-compatibility": 20 }, "prefer-stable": true, "prefer-lowest": false, @@ -742,5 +969,5 @@ "php": ">=7.0" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/mu-plugins/10up-plugin/.lintstagedrc.json b/mu-plugins/10up-plugin/.lintstagedrc.json index b96bb4cc..ab9f1429 100644 --- a/mu-plugins/10up-plugin/.lintstagedrc.json +++ b/mu-plugins/10up-plugin/.lintstagedrc.json @@ -9,6 +9,6 @@ "10up-toolkit lint-js" ], "*.php": [ - "./vendor/bin/phpcs --extensions=php --warning-severity=8 -s" + "../../vendor/bin/phpcs" ] } diff --git a/mu-plugins/10up-plugin/includes/classes/Module.php b/mu-plugins/10up-plugin/includes/classes/Module.php index 54736c57..a1da0bb0 100644 --- a/mu-plugins/10up-plugin/includes/classes/Module.php +++ b/mu-plugins/10up-plugin/includes/classes/Module.php @@ -36,5 +36,4 @@ abstract public function can_register(); * @return void */ abstract public function register(); - } diff --git a/mu-plugins/10up-plugin/includes/classes/ModuleInitialization.php b/mu-plugins/10up-plugin/includes/classes/ModuleInitialization.php index 4a8fcfd2..8ec01905 100644 --- a/mu-plugins/10up-plugin/includes/classes/ModuleInitialization.php +++ b/mu-plugins/10up-plugin/includes/classes/ModuleInitialization.php @@ -157,5 +157,4 @@ public function get_class( $class_name ) { public function get_all_classes() { return $this->classes; } - } diff --git a/mu-plugins/10up-plugin/includes/core.php b/mu-plugins/10up-plugin/includes/core.php index 924f512d..595a9790 100755 --- a/mu-plugins/10up-plugin/includes/core.php +++ b/mu-plugins/10up-plugin/includes/core.php @@ -8,7 +8,7 @@ namespace TenUpPlugin\Core; use TenUpPlugin\ModuleInitialization; -use \WP_Error; +use WP_Error; use TenUpPlugin\Utility; @@ -18,7 +18,7 @@ * @return void */ function setup() { - $n = function( $function ) { + $n = function ( $function ) { return __NAMESPACE__ . "\\$function"; }; @@ -60,7 +60,7 @@ function init() { if ( ! file_exists( TENUP_PLUGIN_PATH . 'composer.json' ) ) { add_action( 'admin_notices', - function() { + function () { $class = 'notice notice-error'; /* translators: %s: the path to the plugin */ $message = sprintf( __( 'The composer.json file was not found within %s. No classes will be loaded.', 'tenup-plugin' ), TENUP_PLUGIN_PATH ); @@ -94,7 +94,6 @@ function activate() { * @return void */ function deactivate() { - } @@ -122,7 +121,6 @@ function script_url( $script, $context ) { } return TENUP_PLUGIN_URL . "dist/js/{$script}.js"; - } /** @@ -140,7 +138,6 @@ function style_url( $stylesheet, $context ) { } return TENUP_PLUGIN_URL . "dist/css/{$stylesheet}.css"; - } /** @@ -165,7 +162,6 @@ function scripts() { Utility\get_asset_info( 'frontend', 'version' ), true ); - } /** @@ -190,7 +186,6 @@ function admin_scripts() { Utility\get_asset_info( 'admin', 'version' ), true ); - } /** @@ -222,7 +217,6 @@ function styles() { Utility\get_asset_info( 'frontend', 'version' ), ); } - } /** @@ -245,7 +239,6 @@ function admin_styles() { [], Utility\get_asset_info( 'admin', 'version' ), ); - } /** diff --git a/mu-plugins/10up-plugin/plugin.php b/mu-plugins/10up-plugin/plugin.php index aa519385..e52e32f0 100755 --- a/mu-plugins/10up-plugin/plugin.php +++ b/mu-plugins/10up-plugin/plugin.php @@ -1,4 +1,20 @@ 10up PHPCS extended. + + + ./themes/* + ./mu-plugins/* + + + node_modules/ + vendor/ dist/ - plugins/* + + + ./plugins/debug-bar/ + ./plugins/debug-bar-slow-actions/ + ./plugins/query-monitor/ + + - + + + ./mu-plugins/10up-plugin-loader.php + + + + + + diff --git a/themes/10up-theme/.lintstagedrc.json b/themes/10up-theme/.lintstagedrc.json index b96bb4cc..ab9f1429 100644 --- a/themes/10up-theme/.lintstagedrc.json +++ b/themes/10up-theme/.lintstagedrc.json @@ -9,6 +9,6 @@ "10up-toolkit lint-js" ], "*.php": [ - "./vendor/bin/phpcs --extensions=php --warning-severity=8 -s" + "../../vendor/bin/phpcs" ] } diff --git a/themes/10up-theme/includes/blocks.php b/themes/10up-theme/includes/blocks.php index 05d9ca35..699d8b91 100644 --- a/themes/10up-theme/includes/blocks.php +++ b/themes/10up-theme/includes/blocks.php @@ -15,7 +15,7 @@ * @return void */ function setup() { - $n = function( $function ) { + $n = function ( $function ) { return __NAMESPACE__ . "\\$function"; }; @@ -68,7 +68,7 @@ function register_theme_blocks() { if ( file_exists( $markup_file_path ) ) { // only add the render callback if the block has a file called markup.php in it's directory - $block_options['render_callback'] = function( $attributes, $content, $block ) use ( $block_folder ) { + $block_options['render_callback'] = function ( $attributes, $content, $block ) use ( $block_folder ) { // create helpful variables that will be accessible in markup.php file $context = $block->context; @@ -78,11 +78,11 @@ function register_theme_blocks() { include $block_folder . '/markup.php'; return ob_get_clean(); }; - }; + } register_block_type_from_metadata( $block_folder, $block_options ); - }; - }; + } + } if ( $is_pre_wp_6 ) { // Remove the filter after we register the blocks @@ -126,7 +126,6 @@ function blocks_editor_styles() { true ); } - } /** diff --git a/themes/10up-theme/includes/classes/Module.php b/themes/10up-theme/includes/classes/Module.php index 894e0b74..61004ba9 100644 --- a/themes/10up-theme/includes/classes/Module.php +++ b/themes/10up-theme/includes/classes/Module.php @@ -36,5 +36,4 @@ abstract public function can_register(); * @return void */ abstract public function register(); - } diff --git a/themes/10up-theme/includes/classes/ModuleInitialization.php b/themes/10up-theme/includes/classes/ModuleInitialization.php index 32edb105..9841b238 100644 --- a/themes/10up-theme/includes/classes/ModuleInitialization.php +++ b/themes/10up-theme/includes/classes/ModuleInitialization.php @@ -158,5 +158,4 @@ public function get_class( $class_name ) { public function get_all_classes() { return $this->classes; } - } diff --git a/themes/10up-theme/includes/core.php b/themes/10up-theme/includes/core.php index 2660d260..ae11e7d7 100755 --- a/themes/10up-theme/includes/core.php +++ b/themes/10up-theme/includes/core.php @@ -16,7 +16,7 @@ * @return void */ function setup() { - $n = function( $function ) { + $n = function ( $function ) { return __NAMESPACE__ . "\\$function"; }; @@ -46,7 +46,7 @@ function init() { if ( ! file_exists( TENUP_THEME_PATH . 'composer.json' ) ) { add_action( 'admin_notices', - function() { + function () { $class = 'notice notice-error'; /* translators: %s: the path to the plugin */ $message = sprintf( __( 'The composer.json file was not found within %s. No classes will be loaded.', 'tenup-theme' ), TENUP_THEME_PATH ); @@ -152,7 +152,6 @@ function scripts() { true ); */ - } /** @@ -243,7 +242,6 @@ function styles() { Utility\get_asset_info( 'styleguide-style', 'version' ) ); } - } /** @@ -311,10 +309,9 @@ function embed_ct_css() { if ( ! $debug_performance ) { return; - }; + } wp_register_style( 'ct', false ); // phpcs:ignore wp_enqueue_style( 'ct' ); wp_add_inline_style( 'ct', 'head{--ct-is-problematic:solid;--ct-is-affected:dashed;--ct-notify:#0bce6b;--ct-warn:#ffa400;--ct-error:#ff4e42}head,head [rel=stylesheet],head script,head script:not([src])[async],head script:not([src])[defer],head script~meta[http-equiv=content-security-policy],head style,head>meta[charset]:not(:nth-child(-n+5)){display:block}head [rel=stylesheet],head script,head script~meta[http-equiv=content-security-policy],head style,head title,head>meta[charset]:not(:nth-child(-n+5)){margin:5px;padding:5px;border-width:5px;background-color:#fff;color:#333}head ::before,head script,head style{font:16px/1.5 monospace,monospace;display:block}head ::before{font-weight:700}head link[rel=stylesheet],head script[src]{border-style:var(--ct-is-problematic);border-color:var(--ct-warn)}head script[src]::before{content:"[Blocking Script – " attr(src) "]"}head link[rel=stylesheet]::before{content:"[Blocking Stylesheet – " attr(href) "]"}head script:not(:empty),head style:not(:empty){max-height:5em;overflow:auto;background-color:#ffd;white-space:pre;border-color:var(--ct-notify);border-style:var(--ct-is-problematic)}head script:not(:empty)::before{content:"[Inline Script] "}head style:not(:empty)::before{content:"[Inline Style] "}head script:not(:empty)~title,head script[src]:not([async]):not([defer]):not([type=module])~title{display:block;border-style:var(--ct-is-affected);border-color:var(--ct-error)}head script:not(:empty)~title::before,head script[src]:not([async]):not([defer]):not([type=module])~title::before{content:"[ blocked by JS] "}head [rel=stylesheet]:not([media=print]):not(.ct)~script,head style:not(:empty)~script{border-style:var(--ct-is-affected);border-color:var(--ct-warn)}head [rel=stylesheet]:not([media=print]):not(.ct)~script::before,head style:not(:empty)~script::before{content:"[JS blocked by CSS – " attr(src) "]"}head script[src][src][async][defer]{display:block;border-style:var(--ct-is-problematic);border-color:var(--ct-warn)}head script[src][src][async][defer]::before{content:"[async and defer is redundant: prefer defer – " attr(src) "]"}head script:not([src])[async],head script:not([src])[defer]{border-style:var(--ct-is-problematic);border-color:var(--ct-warn)}head script:not([src])[async]::before{content:"The async attribute is redundant on inline scripts"}head script:not([src])[defer]::before{content:"The defer attribute is redundant on inline scripts"}head [rel=stylesheet][href^="//"],head [rel=stylesheet][href^=http],head script[src][src][src^="//"],head script[src][src][src^=http]{border-style:var(--ct-is-problematic);border-color:var(--ct-error)}head script[src][src][src^="//"]::before,head script[src][src][src^=http]::before{content:"[Third Party Blocking Script – " attr(src) "]"}head [rel=stylesheet][href^="//"]::before,head [rel=stylesheet][href^=http]::before{content:"[Third Party Blocking Stylesheet – " attr(href) "]"}head script~meta[http-equiv=content-security-policy]{border-style:var(--ct-is-problematic);border-color:var(--ct-error)}head script~meta[http-equiv=content-security-policy]::before{content:"[Meta CSP defined after JS]"}head>meta[charset]:not(:nth-child(-n+5)){border-style:var(--ct-is-problematic);border-color:var(--ct-warn)}head>meta[charset]:not(:nth-child(-n+5))::before{content:"[Charset should appear as early as possible]"}link[rel=stylesheet].ct,link[rel=stylesheet][media=print],script[async],script[defer],script[type=module],style.ct{display:none}' ); - } diff --git a/themes/10up-theme/includes/overrides.php b/themes/10up-theme/includes/overrides.php index 0edf9970..01556546 100644 --- a/themes/10up-theme/includes/overrides.php +++ b/themes/10up-theme/includes/overrides.php @@ -45,7 +45,6 @@ function setup() { remove_action( 'wp_head', 'wlwmanifest_link' ); // Remove the link to Really Simple Discovery service endpoint. remove_action( 'wp_head', 'rsd_link' ); - } /** diff --git a/themes/10up-theme/includes/utility.php b/themes/10up-theme/includes/utility.php index 2caf8e8e..d5cdf7df 100755 --- a/themes/10up-theme/includes/utility.php +++ b/themes/10up-theme/includes/utility.php @@ -55,7 +55,6 @@ function get_colors( $path ) { return $matches[0]; } - } /** @@ -87,5 +86,4 @@ function adjust_brightness( $hex, $steps ) { } return $return; - }