From 6c36d497a08a8ac74f412e5e0c7246c015ae57f5 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 11:27:40 -0500 Subject: [PATCH 01/13] setup --- .github/workflows/phpcs.yml | 55 + .github/workflows/phpstan.yml | 55 + .github/workflows/phpunit.yml | 12 +- .gitignore | 2 +- .phpcs.xml.dist | 49 - composer.json | 21 + composer.lock | 2657 +++++++++++++++++++++++++++++++++ dev/wordpress-overrides.stub | 54 + phpcs.xml | 100 ++ phpstan.neon | 42 + tests/bootstrap.php | 2 +- tests/composer.json | 6 - tests/composer.lock | 1659 -------------------- 13 files changed, 2992 insertions(+), 1722 deletions(-) create mode 100644 .github/workflows/phpcs.yml create mode 100644 .github/workflows/phpstan.yml delete mode 100644 .phpcs.xml.dist create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 dev/wordpress-overrides.stub create mode 100644 phpcs.xml create mode 100644 phpstan.neon delete mode 100644 tests/composer.json delete mode 100644 tests/composer.lock diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000..337f49f --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,55 @@ +name: PHPCS +run-name: Run PHPCS on `${{ github.head_ref }}` + +on: + pull_request: + paths: + - 'wp-content/themes/familysmiles/**/*.php' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + phpcs: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 + + - name: Detect File Changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + wpcontent: + - added|modified: 'wp-content/themes/familysmiles/**/*.php' + - added|modified: 'wp-content/mu-plugins/cssllc-acceptable-dynamic-headlines.php' + - added|modified: 'wp-content/mu-plugins/domain-verifications.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-acf-list-columns.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-location.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-service.php' + - added|modified: 'wp-content/mu-plugins/favicons.php' + - added|modified: 'wp-content/mu-plugins/google-tag-manager.php' + + - name: Setup PHP + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + ini-values: "memory_limit=1G" + coverage: none + + - name: Validate composer.json and composer.lock + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: composer validate --no-check-publish + + - name: Install Composer dependencies + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: | + composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader + + - name: Run PHPCS checks + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: ./vendor/bin/phpcs ${{ steps.filter.outputs.wpcontent_files }} \ No newline at end of file diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..7e8d2aa --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,55 @@ +name: PHPStan +run-name: Run PHPStan on `${{ github.head_ref }}` + +on: + pull_request: + paths: + - 'wp-content/themes/familysmiles/**/*.php' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + phpstan: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 + + - name: Detect File Changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + wpcontent: + - added|modified: 'wp-content/themes/familysmiles/**/*.php' + - added|modified: 'wp-content/mu-plugins/cssllc-acceptable-dynamic-headlines.php' + - added|modified: 'wp-content/mu-plugins/domain-verifications.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-acf-list-columns.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-location.php' + - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-service.php' + - added|modified: 'wp-content/mu-plugins/favicons.php' + - added|modified: 'wp-content/mu-plugins/google-tag-manager.php' + + - name: Setup PHP + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + ini-values: "memory_limit=1G" + coverage: none + + - name: Validate composer.json and composer.lock + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: composer validate --no-check-publish + + - name: Install Composer dependencies + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: | + composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader + + - name: Run PHPStan checks + if: ${{ steps.filter.outputs.wpcontent == 'true' }} + run: ./vendor/bin/phpstan analyse ${{ steps.filter.outputs.wpcontent_files }} \ No newline at end of file diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 1cd279d..d2d8261 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,12 +1,12 @@ name: PHPUnit -on: +on: push: paths: - Plugin.php - includes/** - tests/** - .github/workflows/phpunit.yml + - Plugin.php + - includes/** + - tests/** + - .github/workflows/phpunit.yml pull_request: workflow_dispatch: @@ -73,4 +73,4 @@ jobs: run: ./bin/install-wp-tests.sh ${MYSQL_DATABASE} ${MYSQL_USER} ${MYSQL_PASSWORD} ${DB_HOST}:${DB_PORT} ${WP_VERSION} - name: phpunit tests - run: ./tests/vendor/bin/phpunit --coverage-text \ No newline at end of file + run: ./vendor/bin/phpunit --coverage-text \ No newline at end of file diff --git a/.gitignore b/.gitignore index 95e643c..926a52a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /report -/tests/vendor +/vendor diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist deleted file mode 100644 index 067d574..0000000 --- a/.phpcs.xml.dist +++ /dev/null @@ -1,49 +0,0 @@ - - - Generally-applicable sniffs for WordPress plugins. - - - . - /vendor/ - /node_modules/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..0ea0ea2 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "require-dev": { + "yoast/phpunit-polyfills": "^1.0", + "phpcompatibility/phpcompatibility-wp": "^2.1", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "automattic/vipwpcs": "^2.3", + "phpunit/phpunit": "^9", + "assertwell/wp-core-test-framework": "^0.2.0", + "phpstan/phpstan": "^1.6", + "php-stubs/wordpress-stubs": "^5.9", + "szepeviktor/phpstan-wordpress": "^1.1", + "phpstan/extension-installer": "^1.1", + "php-stubs/acf-pro-stubs": "^5.12" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true + } + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..a9350c1 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2657 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "647aab990e2cb89743ad99c73f206324", + "packages": [], + "packages-dev": [ + { + "name": "assertwell/wp-core-test-framework", + "version": "v0.2.0", + "source": { + "type": "git", + "url": "https://github.com/assertwell/wp-core-test-framework.git", + "reference": "405676b69043f8846c1bbfdcc0f9ae881c0dce36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/assertwell/wp-core-test-framework/zipball/405676b69043f8846c1bbfdcc0f9ae881c0dce36", + "reference": "405676b69043f8846c1bbfdcc0f9ae881c0dce36", + "shasum": "" + }, + "bin": [ + "bin/install-wp-tests.sh" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Steve Grunwell", + "homepage": "https://stevegrunwell.com" + } + ], + "description": "Streamline testing WordPress plugins and themes using the WordPress core test framework", + "keywords": [ + "testing", + "wordpress" + ], + "support": { + "issues": "https://github.com/assertwell/wp-core-test-framework/issues", + "source": "https://github.com/assertwell/wp-core-test-framework" + }, + "time": "2020-10-26T16:34:37+00:00" + }, + { + "name": "automattic/vipwpcs", + "version": "2.3.3", + "source": { + "type": "git", + "url": "https://github.com/Automattic/VIP-Coding-Standards.git", + "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", + "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7", + "php": ">=5.4", + "sirbrillig/phpcs-variable-analysis": "^2.11.1", + "squizlabs/php_codesniffer": "^3.5.5", + "wp-coding-standards/wpcs": "^2.3" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^0.5", + "php-parallel-lint/php-parallel-lint": "^1.0", + "phpcompatibility/php-compatibility": "^9", + "phpcsstandards/phpcsdevtools": "^1.0", + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/Automattic/VIP-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions", + "keywords": [ + "phpcs", + "standards", + "wordpress" + ], + "support": { + "issues": "https://github.com/Automattic/VIP-Coding-Standards/issues", + "source": "https://github.com/Automattic/VIP-Coding-Standards", + "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" + }, + "time": "2021-09-29T16:20:23+00:00" + }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.2", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2022-02-04T12:51:07+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:23:10+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.15.3", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + }, + "time": "2023-01-16T22:05:37+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "php-stubs/acf-pro-stubs", + "version": "v5.12.3", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/acf-pro-stubs.git", + "reference": "9391822d613d3fde17deac8e6b343c346e5db73f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/acf-pro-stubs/zipball/9391822d613d3fde17deac8e6b343c346e5db73f", + "reference": "9391822d613d3fde17deac8e6b343c346e5db73f", + "shasum": "" + }, + "require": { + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0" + }, + "require-dev": { + "php": "~7.1", + "php-stubs/generator": "^0.8" + }, + "suggest": { + "symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "description": "Advanced Custom Fields PRO stubs for static analysis.", + "homepage": "https://github.com/php-stubs/acf-pro-stubs", + "keywords": [ + "PHPStan", + "acf", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/acf-pro-stubs/issues", + "source": "https://github.com/php-stubs/acf-pro-stubs/tree/v5.12.3" + }, + "time": "2022-12-25T22:14:16+00:00" + }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v5.9.5", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "13ecf204a7e6d215a7c0d23e2aa27940fe617717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/13ecf204a7e6d215a7c0d23e2aa27940fe617717", + "reference": "13ecf204a7e6d215a7c0d23e2aa27940fe617717", + "shasum": "" + }, + "replace": { + "giacocorsiglia/wordpress-stubs": "*" + }, + "require-dev": { + "nikic/php-parser": "< 4.12.0", + "php": "~7.3 || ~8.0", + "php-stubs/generator": "^0.8.1", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpstan": "^1.2" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.9.5" + }, + "time": "2022-11-09T05:32:14+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.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." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "time": "2022-10-25T01:46:02+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "time": "2022-10-24T09:00:36+00:00" + }, + { + "name": "phpstan/extension-installer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.2.0" + }, + "time": "2022-10-17T12:59:16+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.9.14", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.9.14" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-01-19T10:47:09+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.24", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.14", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-01-26T08:26:55+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.6.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-02-04T13:37:15+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "sirbrillig/phpcs-variable-analysis", + "version": "v2.11.10", + "source": { + "type": "git", + "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", + "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/0f25a3766f26df91d6bdda0c8931303fc85499d7", + "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "squizlabs/php_codesniffer": "^3.5.6" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0", + "phpcsstandards/phpcsdevcs": "^1.1", + "phpstan/phpstan": "^1.7", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0", + "sirbrillig/phpcs-import-detection": "^1.1", + "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0@beta" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "VariableAnalysis\\": "VariableAnalysis/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Sam Graham", + "email": "php-codesniffer-variableanalysis@illusori.co.uk" + }, + { + "name": "Payton Swick", + "email": "payton@foolord.com" + } + ], + "description": "A PHPCS sniff to detect problems with variables.", + "keywords": [ + "phpcs", + "static analysis" + ], + "support": { + "issues": "https://github.com/sirbrillig/phpcs-variable-analysis/issues", + "source": "https://github.com/sirbrillig/phpcs-variable-analysis", + "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" + }, + "time": "2023-01-05T18:45:16+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "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", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2022-06-18T07:21:10+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v1.1.7", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "979dcb81a01942b576b9fbf72dcb9515c57a4aa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/979dcb81a01942b576b9fbf72dcb9515c57a4aa8", + "reference": "979dcb81a01942b576b9fbf72dcb9515c57a4aa8", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.8.7", + "symfony/polyfill-php73": "^1.12.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8.0 || ^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.1.7" + }, + "funding": [ + { + "url": "https://www.paypal.me/szepeviktor", + "type": "custom" + }, + { + "url": "https://github.com/szepeviktor", + "type": "github" + } + ], + "time": "2023-02-04T13:10:27+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "7da1894633f168fe244afc6de00d141f27517b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", + "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.3.1" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "phpcompatibility/php-compatibility": "^9.0", + "phpcsstandards/phpcsdevtools": "^1.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." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "wordpress" + ], + "support": { + "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", + "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" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", + "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "yoast/yoastcs": "^2.2.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "support": { + "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2022-11-16T09:07:52+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/dev/wordpress-overrides.stub b/dev/wordpress-overrides.stub new file mode 100644 index 0000000..1fd6084 --- /dev/null +++ b/dev/wordpress-overrides.stub @@ -0,0 +1,54 @@ + + + CSSLLC Coding Standards. + + includes + Plugin.php + + + + + + + + + + + + + + + *-config.php + *assets/ + *vendor/ + *tests/* + extensions\/(?!twig).* + *webpack/ + + + + + includes/types/Image_Tag.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + 3 + + + + + + + + + + + + \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..168d201 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,42 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 8 + paths: + - includes/ + - Plugin.php + excludePaths: + - vendor + bootstrapFiles: + - dev/phpstan-bootstrap.php + - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php + stubFiles: + - dev/wordpress-overrides.stub + dynamicConstantNames: + - CONCATENATE_SCRIPTS + - COMPRESS_SCRIPTS + - COMPRESS_CSS + tmpDir: .phpstan-cache/ + reportUnmatchedIgnoredErrors: false + ignoreErrors: + - '#^Function yoast_get_primary_term_id not found.$#' + # Uses func_get_args() + - '#^Function apply_filters invoked with [34567] parameters, 2 required\.$#' + - '#^Function do_action invoked with [3456] parameters, 1-2 required\.$#' + - '#^Function current_user_can invoked with 2 parameters, 1 required\.$#' + - '#^Function add_query_arg invoked with [123] parameters?, 0 required\.$#' + - '#^Function add_theme_support invoked with [2345] parameters, 1 required\.$#' + - '#^Function wp_sprintf invoked with [23456] parameters, 1 required\.$#' + # https://core.trac.wordpress.org/ticket/43304 + - '/^Parameter #2 \$deprecated of function load_plugin_textdomain expects string, false given\.$/' + # WP-CLI accepts a class as callable + - '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/' + - '#PHPDoc tag @throws with type .*? is not subtype of Throwable#' + - '#Function gravity_form not found.#' + - '/^Parameter #1 \$args of function wp_nav_menu expects.* given\.$/' + + checkAlwaysTrueStrictComparison: true + + # Unfortunately, DocBlocks can't be relied upon in WordPress. + treatPhpDocTypesAsCertain: false \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6c1e95e..1293be3 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -30,5 +30,5 @@ function _manually_load_plugin() { tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); // Start up the WP testing environment. -require 'vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; +require '../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; require $_tests_dir . '/includes/bootstrap.php'; diff --git a/tests/composer.json b/tests/composer.json deleted file mode 100644 index 8dcf1bb..0000000 --- a/tests/composer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "require-dev": { - "yoast/phpunit-polyfills": "^1.0", - "phpunit/phpunit": "^7.5.20" - } -} \ No newline at end of file diff --git a/tests/composer.lock b/tests/composer.lock deleted file mode 100644 index fe9dad5..0000000 --- a/tests/composer.lock +++ /dev/null @@ -1,1659 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "092e1fe0ac70a69c7bd142fb73a6aed5", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.2", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2020-11-13T09:40:50+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2021-10-02T14:08:47+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2021-12-08T12:19:24+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:42:26+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:20:02+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2020-01-08T08:45:45+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:15:22+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:04:30+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:59:04+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:53:42+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-11-11T13:51:24+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:40:27+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:37:18+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:34:24+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:30:19+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2021-03-09T10:59:23+00:00" - }, - { - "name": "yoast/phpunit-polyfills", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "5ea3536428944955f969bc764bbe09738e151ada" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/5ea3536428944955f969bc764bbe09738e151ada", - "reference": "5ea3536428944955f969bc764bbe09738e151ada", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" - }, - "require-dev": { - "yoast/yoastcs": "^2.2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" - } - }, - "autoload": { - "files": [ - "phpunitpolyfills-autoload.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Team Yoast", - "email": "support@yoast.com", - "homepage": "https://yoast.com" - }, - { - "name": "Contributors", - "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" - } - ], - "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", - "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", - "keywords": [ - "phpunit", - "polyfill", - "testing" - ], - "time": "2021-11-23T01:37:03+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "1.1.0" -} \ No newline at end of file From a709da9c63ba0b1b2cc301a9355f5dfeab83d331 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 11:27:51 -0500 Subject: [PATCH 02/13] phpcs fixes --- Plugin.php | 20 +-- includes/abstracts/Base.php | 123 +++++++++------- includes/abstracts/Data_Store.php | 86 ++++++----- includes/abstracts/WordPress.php | 42 +++--- .../class-get-image-most-common-colors.php | 3 + includes/data_stores/Attributes.php | 10 +- includes/data_stores/Settings.php | 1 + includes/interfaces/Conversion.php | 8 +- includes/interfaces/Data_Store.php | 12 +- includes/interfaces/Dynamic_Source.php | 2 +- includes/interfaces/Output.php | 8 +- includes/interfaces/Validation.php | 6 +- includes/types/Image_Tag.php | 10 +- includes/types/JoeSchmoe.php | 21 ++- includes/types/Picsum.php | 138 +++++++++++------- includes/types/Placeholder.php | 87 +++++++---- includes/types/Unsplash.php | 82 +++++++---- includes/types/WP_Attachment.php | 99 +++++++------ includes/types/WP_Theme.php | 28 ++-- 19 files changed, 468 insertions(+), 318 deletions(-) diff --git a/Plugin.php b/Plugin.php index a469bfa..38fdd50 100644 --- a/Plugin.php +++ b/Plugin.php @@ -36,11 +36,12 @@ final class Plugin { * * @return self */ - static function instance() : self { + public static function instance() : self { static $instance = null; - if ( is_null( $instance ) ) + if ( is_null( $instance ) ) { $instance = new self; // @codeCoverageIgnore + } return $instance; } @@ -51,10 +52,8 @@ static function instance() : self { * @codeCoverageIgnore */ protected function __construct() { - add_action( 'template_redirect', array( $this, 'action__template_redirect' ), 100 ); add_action( 'admin_init', array( $this, 'action__admin_init' ) ); - } /** @@ -66,11 +65,11 @@ protected function __construct() { * * @codeCoverageIgnore */ - function action__template_redirect() : void { + public function action__template_redirect() : void { static::include_files(); } - function action__admin_init() : void { + public function action__admin_init() : void { if ( ! wp_doing_ajax() ) { return; } @@ -83,7 +82,7 @@ function action__admin_init() : void { * * @return string */ - static function dir() : string { + public static function dir() : string { return trailingslashit( __DIR__ ); } @@ -93,7 +92,7 @@ static function dir() : string { * @uses static::dir() * @return string */ - static function inc() : string { + public static function inc() : string { return static::dir() . 'includes/'; } @@ -105,7 +104,7 @@ static function inc() : string { * * @codeCoverageIgnore */ - static function include_files() : void { + public static function include_files() : void { $dir = static::inc(); # Interfaces. @@ -126,11 +125,8 @@ static function include_files() : void { # Base. require_once $dir . 'types/Image_Tag.php'; - } } Plugin::instance(); - -?> diff --git a/includes/abstracts/Base.php b/includes/abstracts/Base.php index 1c51ae5..df263f3 100644 --- a/includes/abstracts/Base.php +++ b/includes/abstracts/Base.php @@ -6,6 +6,7 @@ declare( strict_types=1 ); namespace Image_Tag\Abstracts; + use Image_Tag; use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -42,9 +43,10 @@ abstract class Base implements Conversion, Output, Validation { * @param string $property * @return mixed */ - function __get( string $property ) { - if ( 'cache' !== $property ) + public function __get( string $property ) { + if ( 'cache' !== $property ) { return $this->$property; + } } /** @@ -59,9 +61,11 @@ function __get( string $property ) { * @codeCoverageIgnore */ protected function construct( $attributes, $settings ) : void { - if ( is_a( $attributes, static::class ) ) - foreach ( get_object_vars( $attributes ) as $key => $value ) + if ( is_a( $attributes, static::class ) ) { + foreach ( get_object_vars( $attributes ) as $key => $value ) { $this->$key = $value; + } + } $this->create_Attributes( $attributes ); $this->create_Settings( $settings ); @@ -75,8 +79,9 @@ protected function construct( $attributes, $settings ) : void { * @codeCoverageIgnore */ protected function create_Attributes( $attributes ) : void { - if ( !is_null( $this->attributes ) ) + if ( ! is_null( $this->attributes ) ) { return; + } $this->attributes = new Attributes( $attributes ); } @@ -89,8 +94,9 @@ protected function create_Attributes( $attributes ) : void { * @codeCoverageIgnore */ protected function create_Settings( $settings ) : void { - if ( !is_null( $this->settings ) ) + if ( ! is_null( $this->settings ) ) { return; + } $this->settings = new Settings( $settings ); } @@ -112,7 +118,7 @@ protected function create_Settings( $settings ) : void { * @uses $this->output() * @return string */ - function __toString() : string { + public function __toString() : string { return $this->output(); } @@ -125,30 +131,34 @@ function __toString() : string { * @uses Attributes::output() * @return string */ - function output() : string { - if ( !$this->is_valid() ) { - if ( !$this->settings->has( 'fallback' ) ) + public function output() : string { + if ( ! $this->is_valid() ) { + if ( ! $this->settings->has( 'fallback' ) ) { return ''; + } $fallback = $this->fallback(); - if ( !$fallback->is_valid() ) + if ( ! $fallback->is_valid() ) { return ''; + } return $fallback->output(); } $output = ''; - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) + if ( defined( 'WP_DEBUG' ) && constant( 'WP_DEBUG' ) ) { $output .= PHP_EOL; + } $output .= 'output_attributes()->output(); $output .= ' />'; - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) + if ( defined( 'WP_DEBUG' ) && constant( 'WP_DEBUG' ) ) { $output .= PHP_EOL; + } $before = ''; $after = ''; @@ -182,37 +192,41 @@ function output() : string { * ) */ protected function fallback() : Base { - if ( !$this->settings->has( 'fallback' ) ) + if ( ! $this->settings->has( 'fallback' ) ) { return new Image_Tag; + } $fallbacks = $this->settings->get( 'fallback' ); - if ( empty( $fallbacks ) ) + if ( empty( $fallbacks ) ) { return new Image_Tag; + } $fallbacks = ( array ) $fallbacks; # Handle non-associative array of fallbacks. $has_string_keys = ( 0 < count( array_filter( array_keys( $fallbacks ), 'is_string' ) ) ); - if ( !$has_string_keys ) { + if ( ! $has_string_keys ) { # Change image type names to array's keys. $fallbacks = array_flip( $fallbacks ); # Set each array item to true. - array_walk( $fallbacks, function( &$item ) { + array_walk( $fallbacks, function ( &$item ) { $item = true; } ); } foreach ( $fallbacks as $fallback => $conditional ) { - if ( !$conditional ) + if ( ! $conditional ) { continue; + } $img = Image_Tag::create( $fallback, $this->attributes, $this->settings ); - if ( !$img->is_valid() ) + if ( ! $img->is_valid() ) { continue; + } return $img; } @@ -234,11 +248,12 @@ protected function output_attributes() : Attributes { * * @link https://www.a11y-101.com/development/the-alt-attribute */ - if ( !$this->attributes->has( 'alt' ) ) { + if ( ! $this->attributes->has( 'alt' ) ) { $alt = ''; - if ( $this->attributes->has( 'title', false ) ) + if ( $this->attributes->has( 'title', false ) ) { $alt = $this->attributes->get( 'title' ); + } $attributes->set( 'alt', $alt ); } @@ -259,12 +274,13 @@ protected function output_attributes() : Attributes { * @uses $this->noscript() * @return string */ - function lazyload() : string { - if ( !$this->is_valid() ) { + public function lazyload() : string { + if ( ! $this->is_valid() ) { $fallback = $this->fallback(); - if ( !$fallback->is_valid() ) + if ( ! $fallback->is_valid() ) { return ''; + } return $fallback->lazyload(); } @@ -273,8 +289,9 @@ function lazyload() : string { $js = clone $no_js; $lazyload_class = 'lazyload'; - if ( $this->settings->has( 'lazyload-class' ) ) + if ( $this->settings->has( 'lazyload-class' ) ) { $lazyload_class = $this->settings->get( 'lazyload-class' ); + } $js->append( 'class', $lazyload_class . ' hide-if-no-js' ); @@ -305,12 +322,13 @@ function lazyload() : string { $no_js->update( 'loading', 'lazy' ); $no_js = new Image_Tag( $no_js, $this->settings ); - $js = new Image_Tag( $js, $this->settings ); + $js = new Image_Tag( $js, $this->settings ); $output = $js; - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) + if ( defined( 'WP_DEBUG' ) && constant( 'WP_DEBUG' ) ) { $output .= PHP_EOL; + } $output .= $no_js->noscript(); @@ -325,12 +343,13 @@ function lazyload() : string { * @uses $this->output() * @return string */ - function noscript() : string { - if ( !$this->is_valid() ) { + public function noscript() : string { + if ( ! $this->is_valid() ) { $fallback = $this->fallback(); - if ( !$fallback->is_valid() ) + if ( ! $fallback->is_valid() ) { return ''; + } return $fallback->noscript(); } @@ -357,12 +376,14 @@ function noscript() : string { * @uses $this->fallback() * @return self */ - function get_valid( $test_types = null ) : self { - if ( $this->is_valid( $test_types ) ) + public function get_valid( $test_types = null ) : self { + if ( $this->is_valid( $test_types ) ) { return $this; + } - if ( $this->fallback()->is_valid( $test_types ) ) + if ( $this->fallback()->is_valid( $test_types ) ) { return $this->fallback(); + } return new Image_Tag; } @@ -372,7 +393,7 @@ function get_valid( $test_types = null ) : self { * * @return string */ - function get_type() : string { + public function get_type() : string { return static::TYPES[0]; } @@ -382,11 +403,12 @@ function get_type() : string { * @param null|string|array $test_types * @return bool */ - function is_type( $test_types ) : bool { - if ( empty( $test_types ) ) + public function is_type( $test_types ) : bool { + if ( empty( $test_types ) ) { return true; + } - return !empty( array_intersect( static::TYPES, ( array ) $test_types ) ); + return ! empty( array_intersect( static::TYPES, ( array ) $test_types ) ); } /** @@ -398,12 +420,14 @@ function is_type( $test_types ) : bool { * @uses $this->is_type() * @return bool */ - function is_valid( $test_types = null, bool $check_fallback = false ) : bool { - if ( true === $this->check_valid() ) + public function is_valid( $test_types = null, bool $check_fallback = false ) : bool { + if ( true === $this->check_valid() ) { return $this->is_type( $test_types ); + } - if ( !$check_fallback ) + if ( ! $check_fallback ) { return false; + } return $this->fallback()->is_valid( $test_types ); } @@ -417,8 +441,9 @@ function is_valid( $test_types = null, bool $check_fallback = false ) : bool { protected function check_valid() { $errors = $this->perform_validation_checks(); - if ( $errors->has_errors() ) + if ( $errors->has_errors() ) { return $errors; + } return true; } @@ -449,14 +474,14 @@ abstract protected function perform_validation_checks() : \WP_Error; * @uses $this->is_type() * @return \Image_Tag\Types\JoeSchmoe */ - function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe { + public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe { if ( $this->is_type( 'joeschmoe' ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); - $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); + $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); return Image_Tag::create( 'joeschmoe', $attributes, $settings ); } @@ -469,14 +494,14 @@ function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\Jo * @uses $this->is_type() * @return \Image_Tag\Types\Picsum */ - function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum { + public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum { if ( $this->is_type( 'picsum' ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); - $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); + $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); return Image_Tag::create( 'picsum', $attributes, $settings ); } @@ -489,14 +514,14 @@ function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsu * @uses $this->is_type() * @return \Image_Tag\Types\Placeholder */ - function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder { + public function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder { if ( $this->is_type( 'placeholder' ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); - $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); + $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); return Image_Tag::create( 'placeholder', $attributes, $settings ); } @@ -509,14 +534,14 @@ function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\ * @uses $this->is_type() * @return \Image_Tag\Types\Unsplash */ - function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash { + public function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash { if ( $this->is_type( 'unsplash' ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); - $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); + $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); return Image_Tag::create( 'unsplash', $attributes, $settings ); } diff --git a/includes/abstracts/Data_Store.php b/includes/abstracts/Data_Store.php index c808639..d6b723f 100644 --- a/includes/abstracts/Data_Store.php +++ b/includes/abstracts/Data_Store.php @@ -21,7 +21,7 @@ class Data_Store implements \Image_Tag\Interfaces\Data_Store { * * @param array|object $data */ - function __construct( $data ) { + public function __construct( $data ) { if ( is_object( $data ) && is_a( $data, self::class ) @@ -30,8 +30,9 @@ function __construct( $data ) { return; } - if ( !is_array( $data ) ) + if ( ! is_array( $data ) ) { return; + } $this->store = $data; } @@ -42,7 +43,7 @@ function __construct( $data ) { * @param string $key * @return mixed */ - function __get( string $key ) { + public function __get( string $key ) { return $this->$key; } @@ -53,7 +54,7 @@ function __get( string $key ) { * @param mixed $value * @return void */ - function __set( string $key, $value ) : void { + public function __set( string $key, $value ) : void { $this->store[ $key ] = $value; } @@ -63,7 +64,7 @@ function __set( string $key, $value ) : void { * @uses $this->output() * @return string */ - function __toString() : string { + public function __toString() : string { return $this->output(); } @@ -74,20 +75,25 @@ function __toString() : string { * @param null|mixed $value * @return self */ - function set( $set, $value = null ) : self { + public function set( $set, $value = null ) : self { if ( is_array( $set ) ) { - foreach ( $set as $key => $value ) - if ( !array_key_exists( $key, $this->store ) ) - $this->store[ $key ] = $value; + foreach ( $set as $key => $value ) { + if ( array_key_exists( $key, $this->store ) ) { + continue; + } + + $this->store[ $key ] = $value; + } return $this; } if ( - !is_string( $set ) + ! is_string( $set ) || array_key_exists( $set, $this->store ) - ) + ) { return $this; + } if ( is_null( $value ) ) { trigger_error( sprintf( 'Cannot set value of null for key %s.', $set ), E_USER_NOTICE ); @@ -106,10 +112,11 @@ function set( $set, $value = null ) : self { * @param null|mixed $value * @return self */ - function update( $update, $value = null ) : self { + public function update( $update, $value = null ) : self { if ( is_array( $update ) ) { - foreach ( $update as $key => $value ) + foreach ( $update as $key => $value ) { $this->store[ $key ] = $value; + } return $this; } @@ -119,8 +126,9 @@ function update( $update, $value = null ) : self { return $this; } - if ( !is_string( $update ) ) + if ( ! is_string( $update ) ) { return $this; + } $this->store[ $update ] = $value; @@ -134,11 +142,12 @@ function update( $update, $value = null ) : self { * @param bool $check_value * @return bool|array */ - function has( $has = null, bool $check_value = true ) { - if ( in_array( $has, array( null, '', array() ) ) ) - return !empty( $this->store ); + public function has( $has = null, bool $check_value = true ) { + if ( in_array( $has, array( null, '', array() ) ) ) { + return ! empty( $this->store ); + } - if ( is_scalar( $has ) ) + if ( is_scalar( $has ) ) { return ( array_key_exists( $has, $this->store ) || ( @@ -146,15 +155,18 @@ function has( $has = null, bool $check_value = true ) { && in_array( $has, $this->store, true ) ) ); + } - if ( !is_array( $has ) ) + if ( ! is_array( $has ) ) { return false; + } - $has = array_filter( $has, 'is_scalar' ); + $has = array_filter( $has, 'is_scalar' ); $result = array(); - foreach ( $has as $key ) + foreach ( $has as $key ) { $result[ $key ] = $this->has( $key, $check_value ); + } return $result; } @@ -167,21 +179,24 @@ function has( $has = null, bool $check_value = true ) { * @uses $this->has() * @return bool|array */ - function empty( $empty = null ) { - if ( is_scalar( $empty ) ) + public function empty( $empty = null ) { + if ( is_scalar( $empty ) ) { return ( - !$this->has( $empty, false ) + ! $this->has( $empty, false ) || empty( $this->store[ $empty ] ) ); + } - if ( !is_array( $empty ) ) + if ( ! is_array( $empty ) ) { return false; + } - $empty = array_filter( $empty, 'is_scalar' ); + $empty = array_filter( $empty, 'is_scalar' ); $result = array(); - foreach ( $empty as $key ) + foreach ( $empty as $key ) { $result[ $key ] = $this->empty( $key ); + } } /** @@ -189,17 +204,20 @@ function empty( $empty = null ) { * * @return mixed */ - function get( $get = array() ) { - if ( array() === $get ) + public function get( $get = array() ) { + if ( array() === $get ) { return $this->store; + } - if ( is_string( $get ) ) + if ( is_string( $get ) ) { return $this->store[ $get ]; + } $output = array(); - foreach ( $get as $key ) + foreach ( $get as $key ) { $output[ $key ] = $this->store[ $key ]; + } return $output; } @@ -216,8 +234,8 @@ function get( $get = array() ) { * @uses $this->update() * @return self */ - function append( string $key, $value, string $glue = ' ' ) : self { - if ( !$this->has( $key ) ) { + public function append( string $key, $value, string $glue = ' ' ) : self { + if ( ! $this->has( $key ) ) { $this->set( $key, $value ); return $this; } @@ -231,7 +249,7 @@ function append( string $key, $value, string $glue = ' ' ) : self { return $this; } - function remove( string $key ) : self { + public function remove( string $key ) : self { unset( $this->store[ $key ] ); return $this; } diff --git a/includes/abstracts/WordPress.php b/includes/abstracts/WordPress.php index f80a530..15a8641 100644 --- a/includes/abstracts/WordPress.php +++ b/includes/abstracts/WordPress.php @@ -23,16 +23,18 @@ abstract class WordPress extends Base { protected static function identify_colors( string $path, int $count = 3 ) : array { require_once \Image_Tag\Plugin::inc() . 'class-get-image-most-common-colors.php'; - $util = new \GetImageMostCommonColors; + $util = new \GetImageMostCommonColors; $_colors = $util->Get_Colors( $path, $count ); - if ( empty( $_colors ) ) + if ( empty( $_colors ) ) { return array(); + } $colors = array(); - foreach ( $_colors as $color => $percentage ) + foreach ( $_colors as $color => $percentage ) { $colors[] = '#' . $color; + } return $colors; } @@ -45,16 +47,17 @@ protected static function identify_colors( string $path, int $count = 3 ) : arra */ protected static function generate_lqip( string $path ) : string { $editor = wp_get_image_editor( $path ); - $size = $editor->get_size(); - $ratio = $size['height'] / $size['width']; + $size = $editor->get_size(); + $ratio = $size['height'] / $size['width']; $resize_width = 20; $resize_height = 20; - if ( $size['width'] > $size['height'] ) + if ( $size['width'] > $size['height'] ) { $resize_height = $resize_width * $ratio; - else if ( $size['width'] < $size['height'] ) + } else if ( $size['width'] < $size['height'] ) { $resize_width = $resize_height * $ratio; + } $editor->resize( $resize_width, $resize_height ); $editor->set_quality( 50 ); @@ -62,9 +65,10 @@ protected static function generate_lqip( string $path ) : string { $path = $editor->generate_filename( 'lqip', get_temp_dir() ); $editor->save( $path ); - $mime = wp_get_image_mime( $path ); + $mime = wp_get_image_mime( $path ); $plain_encoded = base64_encode( file_get_contents( $path ) ); - $data64 = sprintf( 'data:%s;base64,%s', $mime, $plain_encoded ); + $data64 = sprintf( 'data:%s;base64,%s', $mime, $plain_encoded ); + unlink( $path ); return $data64; @@ -79,17 +83,15 @@ protected static function generate_lqip( string $path ) : string { protected function set_orientation() : void { $ratio = $this->ratio(); - if ( $ratio > 1 ) + if ( $ratio > 1 ) { $this->orientation = 'portrait'; - - else if ( $ratio < 1 ) + } else if ( $ratio < 1 ) { $this->orientation = 'landscape'; - - else if ( 1 === $ratio ) + } else if ( 1 === $ratio ) { $this->orientation = 'square'; - - else + } else { $this->orientation = 'unknown'; + } } /** @@ -97,7 +99,7 @@ protected function set_orientation() : void { * * @return float */ - abstract function ratio() : float; + abstract public function ratio() : float; /** * Get most common colors. @@ -106,7 +108,7 @@ abstract function ratio() : float; * @uses static::identify_colors() * @return array */ - abstract function colors( int $count = 5 ) : array; + abstract public function colors( int $count = 5 ) : array; /** * Get most common color. @@ -114,7 +116,7 @@ abstract function colors( int $count = 5 ) : array; * @uses $this->get_colors() * @return string */ - function mode_color() : string { + public function mode_color() : string { $colors = $this->colors(); return $colors[0]; } @@ -124,6 +126,6 @@ function mode_color() : string { * * @return string */ - abstract function lqip() : string; + abstract public function lqip() : string; } \ No newline at end of file diff --git a/includes/class-get-image-most-common-colors.php b/includes/class-get-image-most-common-colors.php index f98a9f6..e9bdd7c 100644 --- a/includes/class-get-image-most-common-colors.php +++ b/includes/class-get-image-most-common-colors.php @@ -21,6 +21,9 @@ * */ + +// phpcs:ignoreFile + if ( !defined( 'ABSPATH' ) || !function_exists( 'add_filter' ) ) { header( 'Status: 403 Forbidden' ); header( 'HTTP/1.1 403 Forbidden' ); diff --git a/includes/data_stores/Attributes.php b/includes/data_stores/Attributes.php index b7a4a60..5353a20 100644 --- a/includes/data_stores/Attributes.php +++ b/includes/data_stores/Attributes.php @@ -3,6 +3,7 @@ declare( strict_types=1 ); namespace Image_Tag\Data_Stores; + use Image_Tag\Abstracts\Data_Store; /** @@ -15,18 +16,19 @@ class Attributes extends Data_Store { * * @return string */ - function output() : string { + public function output() : string { $prefix = ''; $output = array(); - foreach ( $this->get() as $key => $value ) + foreach ( $this->get() as $key => $value ) { $output[] = sprintf( '%s="%s"', $key, $value ); + } $glue = ' '; - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { + if ( defined( 'WP_DEBUG' ) && constant( 'WP_DEBUG' ) ) { $prefix = PHP_EOL; - $glue .= $prefix; + $glue .= $prefix; } return $prefix . implode( $glue, $output ); diff --git a/includes/data_stores/Settings.php b/includes/data_stores/Settings.php index bc587f5..1389f7b 100644 --- a/includes/data_stores/Settings.php +++ b/includes/data_stores/Settings.php @@ -3,6 +3,7 @@ declare( strict_types=1 ); namespace Image_Tag\Data_Stores; + use Image_Tag\Abstracts\Data_Store; /** diff --git a/includes/interfaces/Conversion.php b/includes/interfaces/Conversion.php index 67ce6fb..c358290 100644 --- a/includes/interfaces/Conversion.php +++ b/includes/interfaces/Conversion.php @@ -18,7 +18,7 @@ interface Conversion { * @param null|array|Settings $settings * @return \Image_Tag\Types\JoeSchmoe */ - function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe; + public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe; /** * Convert to Picsum photo. @@ -27,7 +27,7 @@ function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\Jo * @param null|array|Settings $settings * @return \Image_Tag\Types\Picsum */ - function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum; + public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum; /** * Convert to Placeholder.com image. @@ -36,7 +36,7 @@ function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsu * @param null|array|Settings $settings * @return \Image_Tag\Types\Placeholder */ - function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder; + public function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder; /** * Convert to Unsplash Source photo. @@ -45,6 +45,6 @@ function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\ * @param null|array|Settings $settings * @return \Image_Tag\Types\Unsplash */ - function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash; + public function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash; } \ No newline at end of file diff --git a/includes/interfaces/Data_Store.php b/includes/interfaces/Data_Store.php index bfbf687..854619a 100644 --- a/includes/interfaces/Data_Store.php +++ b/includes/interfaces/Data_Store.php @@ -11,11 +11,11 @@ */ interface Data_Store { - function set( $set, $value = null ) : self; - function update( $update, $value = null ) : self; - function has( $has ); - function get( $get ); - function append( string $key, string $value, string $glue = ' ' ) : self; - function remove( string $key ) : self; + public function set( $set, $value = null ) : self; + public function update( $update, $value = null ) : self; + public function has( $has ); + public function get( $get ); + public function append( string $key, string $value, string $glue = ' ' ) : self; + public function remove( string $key ) : self; } \ No newline at end of file diff --git a/includes/interfaces/Dynamic_Source.php b/includes/interfaces/Dynamic_Source.php index ce0d959..997b050 100644 --- a/includes/interfaces/Dynamic_Source.php +++ b/includes/interfaces/Dynamic_Source.php @@ -11,6 +11,6 @@ */ interface Dynamic_Source { - function generate_source() : string; + public function generate_source() : string; } \ No newline at end of file diff --git a/includes/interfaces/Output.php b/includes/interfaces/Output.php index f5960d9..4f33d1a 100644 --- a/includes/interfaces/Output.php +++ b/includes/interfaces/Output.php @@ -7,12 +7,12 @@ defined( 'WPINC' ) || die(); /** - * Interface: Image_Tag\Intefaces\Output + * Interface: Image_Tag\Interfaces\Output */ interface Output { - function output() : string; - function lazyload() : string; - function noscript() : string; + public function output() : string; + public function lazyload() : string; + public function noscript() : string; } \ No newline at end of file diff --git a/includes/interfaces/Validation.php b/includes/interfaces/Validation.php index ddb95b4..20be30c 100644 --- a/includes/interfaces/Validation.php +++ b/includes/interfaces/Validation.php @@ -11,8 +11,8 @@ */ interface Validation { - function get_type() : string; - function is_type( $test_types ) : bool; - function is_valid( $test_types = null ) : bool; + public function get_type() : string; + public function is_type( $test_types ) : bool; + public function is_valid( $test_types = null ) : bool; } \ No newline at end of file diff --git a/includes/types/Image_Tag.php b/includes/types/Image_Tag.php index 5bef80d..81a8f1a 100644 --- a/includes/types/Image_Tag.php +++ b/includes/types/Image_Tag.php @@ -32,7 +32,7 @@ class Image_Tag extends Base { * @param null|array|Settings $settings * @return Image_Tag */ - static function create( $source, $attributes = null, $settings = null ) : Base { + public static function create( $source, $attributes = null, $settings = null ) : Base { if ( is_a( $source, self::class ) ) { return $source; } @@ -42,8 +42,9 @@ static function create( $source, $attributes = null, $settings = null ) : Base { return new Image_Tag\Types\WP_Attachment( $source, $attributes, $settings ); } - if ( !is_string( $source ) ) + if ( ! is_string( $source ) ) { return new Image_Tag( $attributes, $settings ); + } $_source = strtolower( $source ); @@ -86,7 +87,7 @@ static function create( $source, $attributes = null, $settings = null ) : Base { * @uses $this->construct() * @uses Attributes->set() */ - function __construct( $attributes = null, $settings = null ) { + public function __construct( $attributes = null, $settings = null ) { $this->construct( $attributes, $settings ); } @@ -99,8 +100,9 @@ function __construct( $attributes = null, $settings = null ) { protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; - if ( $this->attributes->empty( 'src' ) ) + if ( $this->attributes->empty( 'src' ) ) { $errors->add( 'empty_source', 'Image tag requires a source.' ); + } return $errors; } diff --git a/includes/types/JoeSchmoe.php b/includes/types/JoeSchmoe.php index ffe9feb..d17b4ba 100644 --- a/includes/types/JoeSchmoe.php +++ b/includes/types/JoeSchmoe.php @@ -8,6 +8,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -36,7 +37,7 @@ class JoeSchmoe extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfac * @param null|array|Settings $settings * @uses $this->construct() */ - function __construct( $attributes = null, $settings = null ) { + public function __construct( $attributes = null, $settings = null ) { $this->construct( $attributes, $settings ); } @@ -61,21 +62,24 @@ protected function output_attributes() : Attributes { * @uses Settings::get() * @return string */ - function generate_source() : string { - if ( array_key_exists( __FUNCTION__, $this->cache ) ) + public function generate_source() : string { + if ( array_key_exists( __FUNCTION__, $this->cache ) ) { return $this->cache[ __FUNCTION__ ]; + } $src = array( static::BASE_URL ); # Gender - if ( $this->settings->has( 'gender' ) ) + if ( $this->settings->has( 'gender' ) ) { $src[] = $this->settings->get( 'gender' ); + } # Seed - if ( $this->settings->has( 'seed' ) ) + if ( $this->settings->has( 'seed' ) ) { $src[] = $this->settings->get( 'seed' ); - else + } else { $src[] = uniqid( 'random-' ); + } # Convert to string $src = implode( '/', $src ); @@ -97,9 +101,10 @@ protected function perform_validation_checks() : \WP_Error { if ( $this->settings->has( 'gender' ) - && !in_array( $this->settings->get( 'gender' ), array( 'male', 'female' ) ) - ) + && ! in_array( $this->settings->get( 'gender' ), array( 'male', 'female' ) ) + ) { $errors->add( 'joeschmoe_binary_gender', 'Joe Schmoes are only available in male and female genders' ); + } return $errors; } diff --git a/includes/types/Picsum.php b/includes/types/Picsum.php index 9b89d6d..3e7485d 100644 --- a/includes/types/Picsum.php +++ b/includes/types/Picsum.php @@ -9,6 +9,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -36,16 +37,17 @@ class Picsum extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfaces\ * @param int $page * @return array */ - static function list( int $page = 1 ) : array { + public static function list( int $page = 1 ) : array { $url = add_query_arg( array( - 'page' => $page, + 'page' => $page, 'limit' => 50, ), static::BASE_URL . '/v2/list' ); $response = wp_remote_get( $url ); - if ( 200 !== wp_remote_retrieve_response_code( $response ) ) + if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { return array(); + } $body = wp_remote_retrieve_body( $response ); return json_decode( $body ); @@ -58,25 +60,26 @@ static function list( int $page = 1 ) : array { * @param int $image_id * @return object */ - static function details( int $image_id ) : object { + public static function details( int $image_id ) : object { $default = ( object ) array( - 'id' => '', - 'author' => '', - 'width' => 0, - 'height' => 0, - 'url' => '', + 'id' => '', + 'author' => '', + 'width' => 0, + 'height' => 0, + 'url' => '', 'download_url' => '', ); - if ( empty( $image_id ) ) + if ( empty( $image_id ) ) { return $default; + } - $url = sprintf( '%s/id/%d/info', static::BASE_URL, $image_id ); - + $url = sprintf( '%s/id/%d/info', static::BASE_URL, $image_id ); $response = wp_remote_get( $url ); - if ( 200 !== wp_remote_retrieve_response_code( $response ) ) + if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { return $default; + } $body = wp_remote_retrieve_body( $response ); return json_decode( $body ); @@ -89,7 +92,7 @@ static function details( int $image_id ) : object { * @param null|array|Settings $settings * @uses $this->construct() */ - function __construct( $attributes = null, $settings = null ) { + public function __construct( $attributes = null, $settings = null ) { $this->construct( $attributes, $settings ); } @@ -102,20 +105,27 @@ function __construct( $attributes = null, $settings = null ) { */ protected function output_attributes() : Attributes { $attributes = parent::output_attributes(); - $attributes->update( 'src', $this->generate_source() ); - $dimensions = array(); + $attributes->update( 'src', $this->generate_source() ); + # Width - if ( $this->settings->has( 'width' ) ) $dimensions[] = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width' ) ) $dimensions[] = $this->attributes->get( 'width' ); + if ( $this->settings->has( 'width' ) ) { + $dimensions[] = $this->settings->get( 'width' ); + } else if ( $this->attributes->has( 'width' ) ) { + $dimensions[] = $this->attributes->get( 'width' ); + } # Height - if ( $this->settings->has( 'height' ) ) $dimensions[] = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height' ) ) $dimensions[] = $this->attributes->get( 'height' ); + if ( $this->settings->has( 'height' ) ) { + $dimensions[] = $this->settings->get( 'height' ); + } else if ( $this->attributes->has( 'height' ) ) { + $dimensions[] = $this->attributes->get( 'height' ); + } - if ( 1 === count( $dimensions ) ) + if ( 1 === count( $dimensions ) ) { $dimensions[] = $dimensions[0]; + } if ( ! $attributes->has( 'width' ) ) { $attributes->set( 'width', $dimensions[0] ); @@ -138,29 +148,38 @@ protected function output_attributes() : Attributes { * @uses Attributes::update() * @return string */ - function generate_source() : string { + public function generate_source() : string { static $random = 1; - if ( array_key_exists( __FUNCTION__, $this->cache ) ) + if ( array_key_exists( __FUNCTION__, $this->cache ) ) { return $this->cache[ __FUNCTION__ ]; + } $src = array( static::BASE_URL ); # Image ID - if ( $this->settings->has( 'image-id', false ) ) + if ( $this->settings->has( 'image-id', false ) ) { $src[] = sprintf( 'id/%d', absint( $this->settings->get( 'image-id' ) ) ); + } # Seed - if ( $this->settings->has( 'seed', false ) ) + if ( $this->settings->has( 'seed', false ) ) { $src[] = sprintf( 'seed/%s', sanitize_title_with_dashes( $this->settings->get( 'seed' ) ) ); + } # Width - if ( $this->settings->has( 'width', false ) ) $src[] = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width', false ) ) $src[] = $this->attributes->get( 'width' ); + if ( $this->settings->has( 'width', false ) ) { + $src[] = $this->settings->get( 'width' ); + } else if ( $this->attributes->has( 'width', false ) ) { + $src[] = $this->attributes->get( 'width' ); + } # Height - if ( $this->settings->has( 'height', false ) ) $src[] = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height', false ) ) $src[] = $this->attributes->get( 'height' ); + if ( $this->settings->has( 'height', false ) ) { + $src[] = $this->settings->get( 'height' ); + } else if ( $this->attributes->has( 'height', false ) ) { + $src[] = $this->attributes->get( 'height' ); + } # Convert to string $src = implode( '/', $src ); @@ -168,15 +187,18 @@ function generate_source() : string { $src .= '.webp'; # Grayscale - if ( $this->settings->has( 'grayscale', false ) ) + if ( $this->settings->has( 'grayscale', false ) ) { $src = add_query_arg( 'grayscale', 1, $src ); + } # Blur - if ( $this->settings->has( 'blur', false ) ) + if ( $this->settings->has( 'blur', false ) ) { $src = add_query_arg( 'blur', absint( $this->settings->get( 'blur' ) ), $src ); + } - if ( $this->settings->has( 'random', false ) ) + if ( $this->settings->has( 'random', false ) ) { $src = add_query_arg( 'random', $random++, $src ); + } $this->cache[ __FUNCTION__ ] = $src; @@ -192,24 +214,29 @@ public function ratio() : float { $width = 0; $height = 0; - if ( $this->settings->has( 'width', false ) ) + if ( $this->settings->has( 'width', false ) ) { $width = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width', false ) ) + } else if ( $this->attributes->has( 'width', false ) ) { $width = $this->attributes->get( 'width' ); + } - if ( $this->settings->has( 'height', false ) ) + if ( $this->settings->has( 'height', false ) ) { $height = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height', false ) ) + } else if ( $this->attributes->has( 'height', false ) ) { $height = $this->attributes->get( 'height' ); + } - if ( empty( $height ) ) + if ( empty( $height ) ) { $height = $width; + } - if ( empty( $width ) ) + if ( empty( $width ) ) { $width = $height; + } - if ( empty( $height ) ) + if ( empty( $height ) ) { return 0; + } return absint( $width ) / absint( $height ); } @@ -241,12 +268,13 @@ protected function perform_validation_checks() : \WP_Error { */ protected function validate_dimensions() : void { if ( - $this->settings->has( 'width', false ) - || $this->attributes->has( 'width', false ) - || $this->settings->has( 'height', false ) + $this->settings->has( 'width', false ) + || $this->settings->has( 'height', false ) + || $this->attributes->has( 'width', false ) || $this->attributes->has( 'height', false ) - ) + ) { return; + } throw new \Exception( 'Picsum requires at least one dimension.' ); } @@ -258,7 +286,7 @@ protected function validate_dimensions() : void { * @param null|array|Settings $settings * @return self */ - function picsum( $attributes = null, $settings = null ) : self { + public function picsum( $attributes = null, $settings = null ) : self { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } @@ -271,28 +299,32 @@ function picsum( $attributes = null, $settings = null ) : self { * @uses static::details() * @return object */ - function info() : object { - if ( array_key_exists( __FUNCTION__, $this->cache ) ) + public function info() : object { + if ( array_key_exists( __FUNCTION__, $this->cache ) ) { return $this->cache[ __FUNCTION__ ]; + } $defaults = ( object ) array( - 'id' => '', - 'author' => '', - 'width' => 0, - 'height' => 0, - 'url' => '', + 'id' => '', + 'author' => '', + 'width' => 0, + 'height' => 0, + 'url' => '', 'download_url' => '', ); - if ( !$this->settings->has( 'image-id' ) ) + if ( ! $this->settings->has( 'image-id' ) ) { return $defaults; + } $id = absint( $this->settings->get( 'image-id' ) ); - if ( empty( $id ) ) + if ( empty( $id ) ) { return $defaults; + } $details = static::details( $id ); + $this->cache[ __FUNCTION__ ] = $details; return $details; diff --git a/includes/types/Placeholder.php b/includes/types/Placeholder.php index e52aa8a..3df6fbe 100644 --- a/includes/types/Placeholder.php +++ b/includes/types/Placeholder.php @@ -8,6 +8,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -35,7 +36,7 @@ class Placeholder extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interf * @param null|array|Settings $settings * @uses $this->construct() */ - function __construct( $attributes = null, $settings = null ) { + public function __construct( $attributes = null, $settings = null ) { $this->construct( $attributes, $settings ); } @@ -48,20 +49,27 @@ function __construct( $attributes = null, $settings = null ) { */ protected function output_attributes() : Attributes { $attributes = parent::output_attributes(); - $attributes->update( 'src', $this->generate_source() ); - $dimensions = array(); + $attributes->update( 'src', $this->generate_source() ); + # Width - if ( $this->settings->has( 'width' ) ) $dimensions[] = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width' ) ) $dimensions[] = $this->attributes->get( 'width' ); + if ( $this->settings->has( 'width' ) ) { + $dimensions[] = $this->settings->get( 'width' ); + } else if ( $this->attributes->has( 'width' ) ) { + $dimensions[] = $this->attributes->get( 'width' ); + } # Height - if ( $this->settings->has( 'height' ) ) $dimensions[] = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height' ) ) $dimensions[] = $this->attributes->get( 'height' ); + if ( $this->settings->has( 'height' ) ) { + $dimensions[] = $this->settings->get( 'height' ); + } else if ( $this->attributes->has( 'height' ) ) { + $dimensions[] = $this->attributes->get( 'height' ); + } - if ( 1 === count( $dimensions ) ) + if ( 1 === count( $dimensions ) ) { $dimensions[] = $dimensions[0]; + } if ( ! $attributes->has( 'width' ) ) { $attributes->set( 'width', $dimensions[0] ); @@ -75,7 +83,7 @@ protected function output_attributes() : Attributes { } /** - * Generage image source. + * Generate image source. * * @uses Settings::has() * @uses Settings::get() @@ -83,24 +91,31 @@ protected function output_attributes() : Attributes { * @uses Attributes::get() * @return string */ - function generate_source() : string { - if ( array_key_exists( __FUNCTION__, $this->cache ) ) + public function generate_source() : string { + if ( array_key_exists( __FUNCTION__, $this->cache ) ) { return $this->cache[ __FUNCTION__ ]; - - $src = array( static::BASE_URL ); + } $dimensions = array(); + $src = array( static::BASE_URL ); # Width - if ( $this->settings->has( 'width' ) ) $dimensions[] = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width' ) ) $dimensions[] = $this->attributes->get( 'width' ); + if ( $this->settings->has( 'width' ) ) { + $dimensions[] = $this->settings->get( 'width' ); + } else if ( $this->attributes->has( 'width' ) ) { + $dimensions[] = $this->attributes->get( 'width' ); + } # Height - if ( $this->settings->has( 'height' ) ) $dimensions[] = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height' ) ) $dimensions[] = $this->attributes->get( 'height' ); + if ( $this->settings->has( 'height' ) ) { + $dimensions[] = $this->settings->get( 'height' ); + } else if ( $this->attributes->has( 'height' ) ) { + $dimensions[] = $this->attributes->get( 'height' ); + } - if ( 1 === count( $dimensions ) ) + if ( 1 === count( $dimensions ) ) { $dimensions[] = $dimensions[0]; + } $src[] = implode( 'x', $dimensions ); @@ -108,16 +123,18 @@ function generate_source() : string { if ( $this->settings->has( 'bg_color' ) ) { $src[] = $this->settings->get( 'bg_color' ); - if ( $this->settings->has( 'text_color' ) ) + if ( $this->settings->has( 'text_color' ) ) { $src[] = $this->settings->get( 'text_color' ); + } } # Convert to string $src = implode( '/', $src ); # Custom text - if ( $this->settings->has( 'text' ) ) + if ( $this->settings->has( 'text' ) ) { $src = add_query_arg( 'text', $this->settings->get( 'text' ), $src ); + } $this->cache[ __FUNCTION__ ] = $src; @@ -133,24 +150,29 @@ public function ratio() : float { $width = 0; $height = 0; - if ( $this->settings->has( 'width', false ) ) + if ( $this->settings->has( 'width', false ) ) { $width = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width', false ) ) + } else if ( $this->attributes->has( 'width', false ) ) { $width = $this->attributes->get( 'width' ); + } - if ( $this->settings->has( 'height', false ) ) + if ( $this->settings->has( 'height', false ) ) { $height = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height', false ) ) + } else if ( $this->attributes->has( 'height', false ) ) { $height = $this->attributes->get( 'height' ); + } - if ( empty( $height ) ) + if ( empty( $height ) ) { $height = $width; + } - if ( empty( $width ) ) + if ( empty( $width ) ) { $width = $height; + } - if ( empty( $height ) ) + if ( empty( $height ) ) { return 0; + } return absint( $width ) / absint( $height ); } @@ -182,12 +204,13 @@ protected function perform_validation_checks() : \WP_Error { */ protected function validate_dimensions() : void { if ( - $this->settings->has( 'width', false ) - || $this->attributes->has( 'width', false ) - || $this->settings->has( 'height', false ) + $this->settings->has( 'width', false ) + || $this->settings->has( 'height', false ) + || $this->attributes->has( 'width', false ) || $this->attributes->has( 'height', false ) - ) + ) { return; + } throw new \Exception( 'Placeholder requires at least one dimension.' ); } @@ -199,7 +222,7 @@ protected function validate_dimensions() : void { * @param null|array|Settings $settings * @return self */ - function placeholder( $attributes = null, $settings = null ) : self { + public function placeholder( $attributes = null, $settings = null ) : self { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } diff --git a/includes/types/Unsplash.php b/includes/types/Unsplash.php index 4252b30..5d641b6 100644 --- a/includes/types/Unsplash.php +++ b/includes/types/Unsplash.php @@ -8,6 +8,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -35,7 +36,7 @@ class Unsplash extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interface * @param null|array|Settings $settings * @uses $this->construct() */ - function __construct( $attributes = null, $settings = null ) { + public function __construct( $attributes = null, $settings = null ) { $this->construct( $attributes, $settings ); } @@ -62,11 +63,12 @@ protected function output_attributes() : Attributes { * @uses Attributes::get() * @return string */ - function generate_source() : string { + public function generate_source() : string { static $random = 0; - if ( array_key_exists( __FUNCTION__, $this->cache ) ) + if ( array_key_exists( __FUNCTION__, $this->cache ) ) { return $this->cache[ __FUNCTION__ ]; + } $src = array( static::BASE_URL ); @@ -75,31 +77,33 @@ function generate_source() : string { $src[] = sprintf( 'user/%s', sanitize_title_with_dashes( $this->settings->get( 'user' ) ) ); # User likes - if ( $this->settings->has( 'user_likes', false ) ) + if ( $this->settings->has( 'user_likes', false ) ) { $src[] = 'likes'; + } } # Daily - if ( $this->settings->has( 'daily', false ) ) + if ( $this->settings->has( 'daily', false ) ) { $src[] = 'daily'; # Weekly - else if ( $this->settings->has( 'weekly', false ) ) + } else if ( $this->settings->has( 'weekly', false ) ) { $src[] = 'weekly'; # Collection - else if ( - !$this->settings->has( 'user', false ) + } else if ( + ! $this->settings->has( 'user', false ) && $this->settings->has( 'collection', false ) - ) + ) { $src[] = sprintf( 'collection/%d', absint( $this->settings->get( 'collection' ) ) ); # Photo ID - else if ( - !$this->settings->has( 'user', false ) + } else if ( + ! $this->settings->has( 'user', false ) && $this->settings->has( 'photo_id', false ) - ) + ) { $src[] = $this->settings->get( 'photo_id' ); + } # Random $random_arg = ''; @@ -114,19 +118,26 @@ function generate_source() : string { # Dimensions if ( - !$this->settings->has( 'daily' ) - && !$this->settings->has( 'weekly' ) + ! $this->settings->has( 'daily' ) + && ! $this->settings->has( 'weekly' ) ) { $dimensions = array(); - if ( $this->settings->has( 'width', false ) ) $dimensions[] = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width', false ) ) $dimensions[] = $this->attributes->get( 'width' ); + if ( $this->settings->has( 'width', false ) ) { + $dimensions[] = $this->settings->get( 'width' ); + } else if ( $this->attributes->has( 'width', false ) ) { + $dimensions[] = $this->attributes->get( 'width' ); + } - if ( $this->settings->has( 'height', false ) ) $dimensions[] = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height', false ) ) $dimensions[] = $this->attributes->get( 'height' ); + if ( $this->settings->has( 'height', false ) ) { + $dimensions[] = $this->settings->get( 'height' ); + } else if ( $this->attributes->has( 'height', false ) ) { + $dimensions[] = $this->attributes->get( 'height' ); + } - if ( 1 === count( $dimensions ) ) + if ( 1 === count( $dimensions ) ) { $dimensions[] = $dimensions[0]; + } $src[] = implode( 'x', $dimensions ); @@ -139,8 +150,9 @@ function generate_source() : string { if ( $this->settings->has( 'search', false ) ) { $src .= '?' . ( ( string ) $this->settings->get( 'search' ) ); - if ( !empty( $random ) ) + if ( ! empty( $random ) ) { $random_arg = '&random=' . $random; + } } $src .= $random_arg; @@ -159,24 +171,29 @@ public function ratio() : float { $width = 0; $height = 0; - if ( $this->settings->has( 'width', false ) ) + if ( $this->settings->has( 'width', false ) ) { $width = $this->settings->get( 'width' ); - else if ( $this->attributes->has( 'width', false ) ) + } else if ( $this->attributes->has( 'width', false ) ) { $width = $this->attributes->get( 'width' ); + } - if ( $this->settings->has( 'height', false ) ) + if ( $this->settings->has( 'height', false ) ) { $height = $this->settings->get( 'height' ); - else if ( $this->attributes->has( 'height', false ) ) + } else if ( $this->attributes->has( 'height', false ) ) { $height = $this->attributes->get( 'height' ); + } - if ( empty( $height ) ) + if ( empty( $height ) ) { $height = $width; + } - if ( empty( $width ) ) + if ( empty( $width ) ) { $width = $height; + } - if ( empty( $height ) ) + if ( empty( $height ) ) { return 0; + } return absint( $width ) / absint( $height ); } @@ -208,12 +225,13 @@ protected function perform_validation_checks() : \WP_Error { */ protected function validate_dimensions() : void { if ( - $this->settings->has( 'width', false ) - || $this->attributes->has( 'width', false ) - || $this->settings->has( 'height', false ) + $this->settings->has( 'width', false ) + || $this->settings->has( 'height', false ) + || $this->attributes->has( 'width', false ) || $this->attributes->has( 'height', false ) - ) + ) { return; + } throw new \Exception( 'Unsplash Source requires at least one dimension.' ); } @@ -225,7 +243,7 @@ protected function validate_dimensions() : void { * @param null|array|Settings $settings * @return self */ - function unsplash( $attributes = null, $settings = null ) : self { + public function unsplash( $attributes = null, $settings = null ) : self { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } diff --git a/includes/types/WP_Attachment.php b/includes/types/WP_Attachment.php index 3b8c122..628ade7 100644 --- a/includes/types/WP_Attachment.php +++ b/includes/types/WP_Attachment.php @@ -6,6 +6,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -17,7 +18,7 @@ class WP_Attachment extends \Image_Tag\Abstracts\WordPress { protected $attachment_id; - protected $wp_largest_size = 'thumbnail'; + protected $wp_largest_size = 'thumbnail'; protected $wp_smallest_size = 'full'; /** @@ -36,7 +37,7 @@ class WP_Attachment extends \Image_Tag\Abstracts\WordPress { * @uses wp_get_upload_dir() * @return string */ - static function uploads_dir() : string { + public static function uploads_dir() : string { $uploads = wp_get_upload_dir(); return $uploads['basedir']; } @@ -51,14 +52,15 @@ static function uploads_dir() : string { * @uses $this->is_valid() * @uses $this->identify_sizes(); */ - function __construct( int $attachment_id, $attributes = null, $settings = null ) { - $attachment_id = ( int ) apply_filters( 'image_tag/wp_attachment/attachment_id', $attachment_id, $attributes, $settings ); + public function __construct( int $attachment_id, $attributes = null, $settings = null ) { + $attachment_id = ( int ) apply_filters( 'image_tag/wp_attachment/attachment_id', $attachment_id, $attributes, $settings ); $this->attachment_id = $attachment_id; $this->construct( $attributes, $settings ); - if ( !$this->is_valid() ) + if ( ! $this->is_valid() ) { return; + } $this->identify_sizes(); $this->set_orientation(); @@ -71,9 +73,10 @@ function __construct( int $attachment_id, $attributes = null, $settings = null ) * @uses parent::__get() * @return mixed */ - function __get( string $property ) { - if ( 'attachment_id' === $property ) + public function __get( string $property ) { + if ( 'attachment_id' === $property ) { return $this->attachment_id; + } return parent::__get( $property ); } @@ -95,8 +98,9 @@ protected function metadata() : array { * @return string */ protected function path( string $size = 'full' ) : string { - if ( 'full' === $size ) + if ( 'full' === $size ) { return get_attached_file( $this->attachment_id ); + } $metadata = $this->metadata(); @@ -113,7 +117,7 @@ protected function path( string $size = 'full' ) : string { * @return void */ protected function identify_sizes() : void { - if ( !$this->settings->has( 'image-sizes' ) ) { + if ( ! $this->settings->has( 'image-sizes' ) ) { $this->wp_smallest_size = 'full'; $this->wp_largest_size = 'full'; @@ -141,7 +145,7 @@ protected function identify_sizes() : void { return; } - $all_sizes = $meta['sizes']; + $all_sizes = $meta['sizes']; $all_sizes['full'] = array( 'file' => basename( $meta['file'] ), 'width' => $meta['width'], @@ -149,9 +153,9 @@ protected function identify_sizes() : void { ); $requested_sizes = array_flip( $this->settings->get( 'image-sizes' ) ); - $sizes = array_intersect_key( $all_sizes, $requested_sizes ); + $sizes = array_intersect_key( $all_sizes, $requested_sizes ); - $largest_sq_px = absint( $all_sizes[ $this->wp_largest_size ]['width'] ) * absint( $all_sizes[ $this->wp_largest_size ]['height'] ); + $largest_sq_px = absint( $all_sizes[ $this->wp_largest_size ]['width'] ) * absint( $all_sizes[ $this->wp_largest_size ]['height'] ); $smallest_sq_px = absint( $all_sizes[ $this->wp_smallest_size ]['width'] ) * absint( $all_sizes[ $this->wp_smallest_size ]['height'] ); foreach ( $sizes as $size => $data ) { @@ -162,13 +166,13 @@ protected function identify_sizes() : void { # Compare to largest square pixels if ( $this_sq_px > $largest_sq_px ) { $this->wp_largest_size = $size; - $largest_sq_px = $this_sq_px; + $largest_sq_px = $this_sq_px; } # Compare to smallest square pixels if ( $this_sq_px < $smallest_sq_px ) { $this->wp_smallest_size = $size; - $smallest_sq_px = $this_sq_px; + $smallest_sq_px = $this_sq_px; } } } @@ -178,11 +182,12 @@ protected function identify_sizes() : void { * * @return float */ - function ratio() : float { + public function ratio() : float { $size = wp_get_attachment_image_src( $this->attachment_id, $this->wp_largest_size ); - if ( empty( $size ) || empty( $size[1] ) || empty( $size[2] ) ) + if ( empty( $size ) || empty( $size[1] ) || empty( $size[2] ) ) { return 0; + } return absint( $size[1] ) / absint( $size[2] ); } @@ -194,20 +199,22 @@ function ratio() : float { * @uses static::identify_colors() * @return array */ - function colors( int $count = 3 ) : array { + public function colors( int $count = 3 ) : array { $meta = get_post_meta( $this->attachment_id, '_common_colors', true ); if ( - !empty( $meta ) + ! empty( $meta ) && count( $meta ) >= $count - ) + ) { return array_slice( $meta, 0, $count ); + } $path = $this->path( 'thumbnail' ); $colors = static::identify_colors( $path, $count ); - if ( empty( $colors ) ) + if ( empty( $colors ) ) { return array(); + } update_post_meta( $this->attachment_id, '_common_colors', $colors ); @@ -222,14 +229,15 @@ function colors( int $count = 3 ) : array { protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; - if ( empty( $this->attachment_id ) ) + if ( empty( $this->attachment_id ) ) { $errors->add( 'attachment_id', 'Attachment ID is missing.' ); - else if ( 'attachment' !== get_post_type( $this->attachment_id ) ) + } else if ( 'attachment' !== get_post_type( $this->attachment_id ) ) { $errors->add( 'not_attachment', 'Provided ID is not for an attachment.' ); - else if ( !wp_attachment_is_image( $this->attachment_id ) ) + } else if ( ! wp_attachment_is_image( $this->attachment_id ) ) { $errors->add( 'not_image', 'Attachment is not an image.' ); + } return $errors; } @@ -245,8 +253,9 @@ public function output_attributes() : Attributes { $attributes->set( 'class', 'attachment attachment-' . $this->attachment_id ); - if ( empty( $attributes->alt ) ) + if ( empty( $attributes->alt ) ) { $attributes->update( 'alt', get_the_title( $this->attachment_id ) ); + } $this->output_source_attributes( $attributes ); @@ -261,48 +270,55 @@ public function output_attributes() : Attributes { */ protected function output_source_attributes( &$attributes ) : void { $src = wp_get_attachment_image_src( $this->attachment_id, $this->wp_smallest_size ); - $attributes->set( 'src', $src[0] ); - $attributes->set( 'width', $src[1] ); + + $attributes->set( 'src', $src[0] ); + $attributes->set( 'width', $src[1] ); $attributes->set( 'height', $src[2] ); if ( - !$this->settings->has( 'image-sizes' ) + ! $this->settings->has( 'image-sizes' ) || 1 === count( $this->settings->get( 'image-sizes' ) ) - ) + ) { return; + } $requested_sizes = $this->settings->get( 'image-sizes' ); - $wp_sizes = get_intermediate_image_sizes(); - $wp_sizes[] = 'full'; - $sizes = array_intersect( $requested_sizes, $wp_sizes ); - $sizes = array_unique( $sizes ); + $wp_sizes = get_intermediate_image_sizes(); + $wp_sizes[] = 'full'; + $sizes = array_intersect( $requested_sizes, $wp_sizes ); + $sizes = array_unique( $sizes ); $glue = ', '; - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) + if ( defined( 'WP_DEBUG' ) && constant( 'WP_DEBUG' ) ) { $glue .= PHP_EOL . "\t"; + } $widths = array(); foreach ( $sizes as $size ) { $src = wp_get_attachment_image_src( $this->attachment_id, $size ); - if ( empty( $src ) ) + if ( empty( $src ) ) { continue; + } - if ( in_array( $src[1], $widths ) ) + if ( in_array( $src[1], $widths ) ) { continue; + } $widths[] = $src[1]; - $value = $src[0] . ' ' . $src[1] . 'w'; + $value = $src[0] . ' ' . $src[1] . 'w'; + $attributes->append( 'srcset', $value, $glue ); } if ( - $attributes->has( 'srcset' ) - && !$attributes->has( 'sizes' ) - ) + $attributes->has( 'srcset' ) + && ! $attributes->has( 'sizes' ) + ) { $attributes->set( 'sizes', '100vw' ); + } } /** @@ -315,11 +331,12 @@ protected function output_source_attributes( &$attributes ) : void { * @uses $this->path() * @return string */ - function lqip() : string { + public function lqip() : string { $meta = get_post_meta( $this->attachment_id, '_lqip', true ); - if ( !empty( $meta ) ) + if ( ! empty( $meta ) ) { return $meta; + } $lqip = static::generate_lqip( $this->path( 'medium' ) ); diff --git a/includes/types/WP_Theme.php b/includes/types/WP_Theme.php index 5eed6d8..31587f4 100644 --- a/includes/types/WP_Theme.php +++ b/includes/types/WP_Theme.php @@ -6,6 +6,7 @@ declare( strict_types=1 ); namespace Image_Tag\Types; + use Image_Tag\Data_Stores\Attributes; use Image_Tag\Data_Stores\Settings; @@ -35,22 +36,23 @@ class WP_Theme extends \Image_Tag\Abstracts\WordPress { * @param null|array|Attributes $attributes * @param null|array|Settings $settings */ - function __construct( string $source, $attributes = null, $settings = null ) { + public function __construct( string $source, $attributes = null, $settings = null ) { $stylesheet = trailingslashit( get_stylesheet_directory() ); $template = trailingslashit( get_template_directory() ); if ( file_exists( $stylesheet . $source ) ) { $this->path = $stylesheet . $source; - $url = trailingslashit( get_stylesheet_directory_uri() ) . $source; + $url = trailingslashit( get_stylesheet_directory_uri() ) . $source; } else if ( file_exists( $template . $source ) ) { $this->path = $template . $source; - $url = trailingslashit( get_template_directory_uri() ) . $source; + $url = trailingslashit( get_template_directory_uri() ) . $source; } $this->construct( $attributes, $settings ); - if ( empty( $url ) ) + if ( empty( $url ) ) { return; + } $this->attributes->set( 'src', $url ); } @@ -64,16 +66,18 @@ function __construct( string $source, $attributes = null, $settings = null ) { * * @todo implement temporary caching */ - function colors( int $count = 3 ) : array { + public function colors( int $count = 3 ) : array { $cache_key = sprintf( '%s-%d', __FUNCTION__, $count ); - if ( array_key_exists( $cache_key, $this->cache ) ) + if ( array_key_exists( $cache_key, $this->cache ) ) { return $this->cache[ $cache_key ]; + } $colors = static::identify_colors( $this->path, $count ); - if ( empty( $colors ) ) + if ( empty( $colors ) ) { return array(); + } $this->cache[ $cache_key ] = $colors; @@ -88,8 +92,9 @@ function colors( int $count = 3 ) : array { protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; - if ( empty( $this->path ) ) + if ( empty( $this->path ) ) { $errors->add( 'not_exists', 'Unable to find theme image.' ); + } return $errors; } @@ -101,9 +106,10 @@ protected function perform_validation_checks() : \WP_Error { * @uses getimagesize() * @return float */ - function ratio() : float { - if ( !$this->is_valid() ) + public function ratio() : float { + if ( ! $this->is_valid() ) { return 0; + } $dimensions = getimagesize( $this->path ); @@ -115,7 +121,7 @@ function ratio() : float { * * @return string */ - function lqip() : string { + public function lqip() : string { return ''; } From 4c6d7ba199956efe4d22b265a8d60ab7f3e45574 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 14:09:39 -0500 Subject: [PATCH 03/13] phpstan fixes --- .gitignore | 1 + dev/phpstan-bootstrap.php | 3 + dev/wordpress-overrides.stub | 22 +++++++ includes/abstracts/Base.php | 101 ++++++++++++++++++++--------- includes/abstracts/Data_Store.php | 30 ++++++--- includes/abstracts/WordPress.php | 31 +++++++-- includes/interfaces/Conversion.php | 19 +++--- includes/interfaces/Data_Store.php | 31 +++++++++ includes/interfaces/Validation.php | 8 +++ includes/types/Image_Tag.php | 16 ++--- includes/types/JoeSchmoe.php | 8 +-- includes/types/Picsum.php | 18 ++--- includes/types/Placeholder.php | 16 ++--- includes/types/Unsplash.php | 12 ++-- includes/types/WP_Attachment.php | 29 +++++++-- includes/types/WP_Theme.php | 17 +++-- phpstan.neon | 6 +- 17 files changed, 262 insertions(+), 106 deletions(-) create mode 100644 dev/phpstan-bootstrap.php diff --git a/.gitignore b/.gitignore index 926a52a..3f48664 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /report /vendor +/.phpstan-cache \ No newline at end of file diff --git a/dev/phpstan-bootstrap.php b/dev/phpstan-bootstrap.php new file mode 100644 index 0000000..b5626c1 --- /dev/null +++ b/dev/phpstan-bootstrap.php @@ -0,0 +1,3 @@ +create_Attributes() * @uses $this->create_Settings() * @return void @@ -61,7 +72,7 @@ public function __get( string $property ) { * @codeCoverageIgnore */ protected function construct( $attributes, $settings ) : void { - if ( is_a( $attributes, static::class ) ) { + if ( is_object( $attributes ) && is_a( $attributes, static::class ) ) { foreach ( get_object_vars( $attributes ) as $key => $value ) { $this->$key = $value; } @@ -74,12 +85,14 @@ protected function construct( $attributes, $settings ) : void { /** * Create Attributes object. * - * @param void + * @param null|mixed[]|Attributes $attributes + * + * @return void * * @codeCoverageIgnore */ protected function create_Attributes( $attributes ) : void { - if ( ! is_null( $this->attributes ) ) { + if ( is_object( $this->attributes ) && is_a( $this->attributes, Attributes::class ) ) { return; } @@ -89,12 +102,14 @@ protected function create_Attributes( $attributes ) : void { /** * Create Settings object. * + * @param null|mixed[]|Settings $settings + * * @return void * * @codeCoverageIgnore */ protected function create_Settings( $settings ) : void { - if ( ! is_null( $this->settings ) ) { + if ( is_object( $this->settings ) && is_a( $this->settings, Settings::class ) ) { return; } @@ -371,7 +386,7 @@ public function noscript() : string { /** * Get valid object, either this or fallback. * - * @param null|string|array $test_types + * @param null|string|string[] $test_types * @uses $this->is_valid() * @uses $this->fallback() * @return self @@ -400,7 +415,7 @@ public function get_type() : string { /** * Test image type. * - * @param null|string|array $test_types + * @param null|string|string[] $test_types * @return bool */ public function is_type( $test_types ) : bool { @@ -414,7 +429,7 @@ public function is_type( $test_types ) : bool { /** * Check image is valid. * - * @param null|string|array $test_types + * @param null|string|string[] $test_types * @param bool $check_fallback * @uses $this->check_valid() * @uses $this->is_type() @@ -469,13 +484,13 @@ abstract protected function perform_validation_checks() : \WP_Error; /** * Convert to JoeSchmoe. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->is_type() * @return \Image_Tag\Types\JoeSchmoe */ public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe { - if ( $this->is_type( 'joeschmoe' ) ) { + if ( is_a( $this, \Image_Tag\Types\JoeSchmoe::class ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } @@ -483,19 +498,25 @@ public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\T $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); - return Image_Tag::create( 'joeschmoe', $attributes, $settings ); + $created = Image_Tag::create( 'joeschmoe', $attributes, $settings ); + + if ( ! is_a( $created, \Image_Tag\Types\JoeSchmoe::class ) ) { + return new \Image_Tag\Types\JoeSchmoe; + } + + return $created; } /** * Convert to Picsum photo. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->is_type() * @return \Image_Tag\Types\Picsum */ public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum { - if ( $this->is_type( 'picsum' ) ) { + if ( is_a( $this, \Image_Tag\Types\Picsum::class ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } @@ -503,19 +524,25 @@ public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Type $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); - return Image_Tag::create( 'picsum', $attributes, $settings ); + $created = Image_Tag::create( 'picsum', $attributes, $settings ); + + if ( ! is_a( $created, \Image_Tag\Types\Picsum::class ) ) { + return new \Image_Tag\Types\Picsum; + } + + return $created; } /** * Convert to Placeholder.com image. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->is_type() * @return \Image_Tag\Types\Placeholder */ public function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder { - if ( $this->is_type( 'placeholder' ) ) { + if ( is_a( $this, \Image_Tag\Types\Placeholder::class ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } @@ -523,19 +550,25 @@ public function placeholder( $attributes = null, $settings = null ) : \Image_Tag $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); - return Image_Tag::create( 'placeholder', $attributes, $settings ); + $created = Image_Tag::create( 'placeholder', $attributes, $settings ); + + if ( ! is_a( $created, \Image_Tag\Types\Placeholder::class ) ) { + return new \Image_Tag\Types\Placeholder; + } + + return $created; } /** * Convert to Unsplash Source photo. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->is_type() * @return \Image_Tag\Types\Unsplash */ public function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash { - if ( $this->is_type( 'unsplash' ) ) { + if ( is_a( $this, \Image_Tag\Types\Unsplash::class ) ) { trigger_error( sprintf( 'Image is already type %s', $this->get_type() ) ); return $this; } @@ -543,7 +576,13 @@ public function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Ty $attributes = wp_parse_args( ( array ) $attributes, $this->attributes->store ); $settings = wp_parse_args( ( array ) $settings, $this->settings->store ); - return Image_Tag::create( 'unsplash', $attributes, $settings ); + $created = Image_Tag::create( 'unsplash', $attributes, $settings ); + + if ( ! is_a( $created, \Image_Tag\Types\Unsplash::class ) ) { + return new \Image_Tag\Types\Unsplash; + } + + return $created; } } diff --git a/includes/abstracts/Data_Store.php b/includes/abstracts/Data_Store.php index d6b723f..9b4905a 100644 --- a/includes/abstracts/Data_Store.php +++ b/includes/abstracts/Data_Store.php @@ -8,18 +8,20 @@ /** * Abstract class: Image_Tag\Abstracts\Data_Store + * + * @property mixed[] $store */ class Data_Store implements \Image_Tag\Interfaces\Data_Store { /** - * @var array Data storage. + * @var mixed[] Data storage. */ protected $store = array(); /** * Construct. * - * @param array|object $data + * @param null|mixed[]|self $data */ public function __construct( $data ) { if ( @@ -65,13 +67,17 @@ public function __set( string $key, $value ) : void { * @return string */ public function __toString() : string { + if ( ! method_exists( $this, 'output' ) ) { + return ''; + } + return $this->output(); } /** * Set key/value pair. * - * @param string|array $set + * @param string|string[] $set * @param null|mixed $value * @return self */ @@ -108,7 +114,7 @@ public function set( $set, $value = null ) : self { /** * Update key/value pair. * - * @param string|array $update + * @param string|string[] $update * @param null|mixed $value * @return self */ @@ -138,9 +144,9 @@ public function update( $update, $value = null ) : self { /** * Check if key or value exists in store. * - * @param string|array $has + * @param string|string[] $has * @param bool $check_value - * @return bool|array + * @return bool|mixed[] */ public function has( $has = null, bool $check_value = true ) { if ( in_array( $has, array( null, '', array() ) ) ) { @@ -165,7 +171,7 @@ public function has( $has = null, bool $check_value = true ) { $result = array(); foreach ( $has as $key ) { - $result[ $key ] = $this->has( $key, $check_value ); + $result[ $key ] = $this->has( ( string ) $key, $check_value ); } return $result; @@ -175,9 +181,9 @@ public function has( $has = null, bool $check_value = true ) { * Check if key(s) does not exist in store, * or value is empty. * - * @param string|array $empty + * @param string|string[] $empty * @uses $this->has() - * @return bool|array + * @return bool|mixed[] */ public function empty( $empty = null ) { if ( is_scalar( $empty ) ) { @@ -195,13 +201,17 @@ public function empty( $empty = null ) { $result = array(); foreach ( $empty as $key ) { - $result[ $key ] = $this->empty( $key ); + $result[ $key ] = $this->empty( ( string ) $key ); } + + return $result; } /** * Get data by key. * + * @param string|string[] $get + * * @return mixed */ public function get( $get = array() ) { diff --git a/includes/abstracts/WordPress.php b/includes/abstracts/WordPress.php index 15a8641..a3156b7 100644 --- a/includes/abstracts/WordPress.php +++ b/includes/abstracts/WordPress.php @@ -11,6 +11,9 @@ */ abstract class WordPress extends Base { + /** + * @var string + */ protected $orientation = null; /** @@ -18,7 +21,7 @@ abstract class WordPress extends Base { * * @param string $path * @param int $count - * @return array + * @return string[] */ protected static function identify_colors( string $path, int $count = 3 ) : array { require_once \Image_Tag\Plugin::inc() . 'class-get-image-most-common-colors.php'; @@ -47,6 +50,11 @@ protected static function identify_colors( string $path, int $count = 3 ) : arra */ protected static function generate_lqip( string $path ) : string { $editor = wp_get_image_editor( $path ); + + if ( is_wp_error( $editor ) ) { + return ''; + } + $size = $editor->get_size(); $ratio = $size['height'] / $size['width']; @@ -62,11 +70,22 @@ protected static function generate_lqip( string $path ) : string { $editor->resize( $resize_width, $resize_height ); $editor->set_quality( 50 ); - $path = $editor->generate_filename( 'lqip', get_temp_dir() ); + $path = ( string ) $editor->generate_filename( 'lqip', get_temp_dir() ); + + if ( empty( $path ) ) { + return ''; + } + $editor->save( $path ); - $mime = wp_get_image_mime( $path ); - $plain_encoded = base64_encode( file_get_contents( $path ) ); + $mime = wp_get_image_mime( $path ); + $contents = ( string ) file_get_contents( $path ); + + if ( empty( $contents ) ) { + return ''; + } + + $plain_encoded = base64_encode( $contents ); $data64 = sprintf( 'data:%s;base64,%s', $mime, $plain_encoded ); unlink( $path ); @@ -87,7 +106,7 @@ protected function set_orientation() : void { $this->orientation = 'portrait'; } else if ( $ratio < 1 ) { $this->orientation = 'landscape'; - } else if ( 1 === $ratio ) { + } else if ( floatval( 1 ) === $ratio ) { $this->orientation = 'square'; } else { $this->orientation = 'unknown'; @@ -106,7 +125,7 @@ abstract public function ratio() : float; * * @param int $count * @uses static::identify_colors() - * @return array + * @return string[] */ abstract public function colors( int $count = 5 ) : array; diff --git a/includes/interfaces/Conversion.php b/includes/interfaces/Conversion.php index c358290..e5de958 100644 --- a/includes/interfaces/Conversion.php +++ b/includes/interfaces/Conversion.php @@ -4,6 +4,9 @@ namespace Image_Tag\Interfaces; +use Image_Tag\Data_Stores\Attributes; +use Image_Tag\Data_Stores\Settings; + defined( 'WPINC' ) || die(); /** @@ -14,8 +17,8 @@ interface Conversion { /** * Convert to Joe Schmoe. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return \Image_Tag\Types\JoeSchmoe */ public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\Types\JoeSchmoe; @@ -23,8 +26,8 @@ public function joeschmoe( $attributes = null, $settings = null ) : \Image_Tag\T /** * Convert to Picsum photo. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return \Image_Tag\Types\Picsum */ public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Types\Picsum; @@ -32,8 +35,8 @@ public function picsum( $attributes = null, $settings = null ) : \Image_Tag\Type /** * Convert to Placeholder.com image. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return \Image_Tag\Types\Placeholder */ public function placeholder( $attributes = null, $settings = null ) : \Image_Tag\Types\Placeholder; @@ -41,8 +44,8 @@ public function placeholder( $attributes = null, $settings = null ) : \Image_Tag /** * Convert to Unsplash Source photo. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return \Image_Tag\Types\Unsplash */ public function unsplash( $attributes = null, $settings = null ) : \Image_Tag\Types\Unsplash; diff --git a/includes/interfaces/Data_Store.php b/includes/interfaces/Data_Store.php index 854619a..2334fd9 100644 --- a/includes/interfaces/Data_Store.php +++ b/includes/interfaces/Data_Store.php @@ -11,11 +11,42 @@ */ interface Data_Store { + /** + * @param string $set + * @param mixed $value + */ public function set( $set, $value = null ) : self; + + /** + * @param string $update + * @param mixed $value + */ public function update( $update, $value = null ) : self; + + /** + * @param string $has + * + * @return mixed + */ public function has( $has ); + + /** + * @param string $get + * + * @return mixed + */ public function get( $get ); + + /** + * @param string $key + * @param string $value + * @param string $glue + */ public function append( string $key, string $value, string $glue = ' ' ) : self; + + /** + * @param string $key + */ public function remove( string $key ) : self; } \ No newline at end of file diff --git a/includes/interfaces/Validation.php b/includes/interfaces/Validation.php index 20be30c..02d2868 100644 --- a/includes/interfaces/Validation.php +++ b/includes/interfaces/Validation.php @@ -12,7 +12,15 @@ interface Validation { public function get_type() : string; + + /** + * @param string[] $test_types + */ public function is_type( $test_types ) : bool; + + /** + * @param null|string[] $test_types + */ public function is_valid( $test_types = null ) : bool; } \ No newline at end of file diff --git a/includes/types/Image_Tag.php b/includes/types/Image_Tag.php index 81a8f1a..51f8bd0 100644 --- a/includes/types/Image_Tag.php +++ b/includes/types/Image_Tag.php @@ -17,7 +17,7 @@ class Image_Tag extends Base { /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'base', @@ -27,13 +27,13 @@ class Image_Tag extends Base { /** * Create image tag. * - * @param int|string $source - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings - * @return Image_Tag + * @param int|string|Base $source + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings + * @return Base */ public static function create( $source, $attributes = null, $settings = null ) : Base { - if ( is_a( $source, self::class ) ) { + if ( is_object( $source ) && is_a( $source, Base::class ) ) { return $source; } @@ -82,8 +82,8 @@ public static function create( $source, $attributes = null, $settings = null ) : /** * Construct. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() * @uses Attributes->set() */ diff --git a/includes/types/JoeSchmoe.php b/includes/types/JoeSchmoe.php index d17b4ba..38fdbc1 100644 --- a/includes/types/JoeSchmoe.php +++ b/includes/types/JoeSchmoe.php @@ -22,7 +22,7 @@ class JoeSchmoe extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfac const BASE_URL = 'https://joeschmoe.io/api/v1'; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'joeschmoe', @@ -33,8 +33,8 @@ class JoeSchmoe extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfac /** * Construct. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() */ public function __construct( $attributes = null, $settings = null ) { @@ -94,7 +94,7 @@ public function generate_source() : string { * * @uses Settings::has() * @uses Settings::get() - * @return WP_Error + * @return \WP_Error */ protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; diff --git a/includes/types/Picsum.php b/includes/types/Picsum.php index 3e7485d..ef166ee 100644 --- a/includes/types/Picsum.php +++ b/includes/types/Picsum.php @@ -23,7 +23,7 @@ class Picsum extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfaces\ const BASE_URL = 'https://picsum.photos'; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'picsum', @@ -35,7 +35,7 @@ class Picsum extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interfaces\ * * @link https://picsum.photos/#list-images Documentation * @param int $page - * @return array + * @return mixed[] */ public static function list( int $page = 1 ) : array { $url = add_query_arg( array( @@ -88,8 +88,8 @@ public static function details( int $image_id ) : object { /** * Construct. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() */ public function __construct( $attributes = null, $settings = null ) { @@ -127,11 +127,11 @@ protected function output_attributes() : Attributes { $dimensions[] = $dimensions[0]; } - if ( ! $attributes->has( 'width' ) ) { + if ( ! $attributes->has( 'width' ) && ! empty( $dimensions[0] ) ) { $attributes->set( 'width', $dimensions[0] ); } - if ( ! $attributes->has( 'height' ) ) { + if ( ! $attributes->has( 'height' ) && ! empty( $dimensions[1] ) ) { $attributes->set( 'height', $dimensions[1] ); } @@ -245,7 +245,7 @@ public function ratio() : float { * Perform validation checks. * * @uses $this->validate_dimensions() - * @return WP_Error + * @return \WP_Error */ protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; @@ -282,8 +282,8 @@ protected function validate_dimensions() : void { /** * Prevent conversion to same type. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return self */ public function picsum( $attributes = null, $settings = null ) : self { diff --git a/includes/types/Placeholder.php b/includes/types/Placeholder.php index 3df6fbe..a7bdc73 100644 --- a/includes/types/Placeholder.php +++ b/includes/types/Placeholder.php @@ -22,7 +22,7 @@ class Placeholder extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interf const BASE_URL = 'https://via.placeholder.com'; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'placeholder', @@ -32,8 +32,8 @@ class Placeholder extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interf /** * Construct. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() */ public function __construct( $attributes = null, $settings = null ) { @@ -71,11 +71,11 @@ protected function output_attributes() : Attributes { $dimensions[] = $dimensions[0]; } - if ( ! $attributes->has( 'width' ) ) { + if ( ! $attributes->has( 'width' ) && ! empty( $dimensions[0] ) ) { $attributes->set( 'width', $dimensions[0] ); } - if ( ! $attributes->has( 'height' ) ) { + if ( ! $attributes->has( 'height' ) && ! empty( $dimensions[1] ) ) { $attributes->set( 'height', $dimensions[1] ); } @@ -181,7 +181,7 @@ public function ratio() : float { * Perform validation checks. * * @uses $this->validate_dimensions() - * @return WP_Error + * @return \WP_Error */ protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; @@ -218,8 +218,8 @@ protected function validate_dimensions() : void { /** * Prevent conversion to same type. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return self */ public function placeholder( $attributes = null, $settings = null ) : self { diff --git a/includes/types/Unsplash.php b/includes/types/Unsplash.php index 5d641b6..d5dc4fb 100644 --- a/includes/types/Unsplash.php +++ b/includes/types/Unsplash.php @@ -22,7 +22,7 @@ class Unsplash extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interface const BASE_URL = 'https://source.unsplash.com'; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'unsplash', @@ -32,8 +32,8 @@ class Unsplash extends \Image_Tag\Abstracts\Base implements \Image_Tag\Interface /** * Construct. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() */ public function __construct( $attributes = null, $settings = null ) { @@ -202,7 +202,7 @@ public function ratio() : float { * Perform validation checks. * * @uses $this->validate_dimensions() - * @return WP_Error + * @return \WP_Error */ protected function perform_validation_checks() : \WP_Error { $errors = new \WP_Error; @@ -239,8 +239,8 @@ protected function validate_dimensions() : void { /** * Prevent conversion to same type. * - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @return self */ public function unsplash( $attributes = null, $settings = null ) : self { diff --git a/includes/types/WP_Attachment.php b/includes/types/WP_Attachment.php index 628ade7..3d2920e 100644 --- a/includes/types/WP_Attachment.php +++ b/includes/types/WP_Attachment.php @@ -17,12 +17,23 @@ */ class WP_Attachment extends \Image_Tag\Abstracts\WordPress { + /** + * @var int + */ protected $attachment_id; + + /** + * @var string + */ protected $wp_largest_size = 'thumbnail'; + + /** + * @var string + */ protected $wp_smallest_size = 'full'; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'attachment', @@ -46,8 +57,8 @@ public static function uploads_dir() : string { * Construct. * * @param int $attachment_id - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings * @uses $this->construct() * @uses $this->is_valid() * @uses $this->identify_sizes(); @@ -84,7 +95,7 @@ public function __get( string $property ) { /** * Get attachment meta data. * - * @return array + * @return mixed[] */ protected function metadata() : array { return ( array ) get_post_meta( $this->attachment_id, '_wp_attachment_metadata', true ); @@ -99,7 +110,7 @@ protected function metadata() : array { */ protected function path( string $size = 'full' ) : string { if ( 'full' === $size ) { - return get_attached_file( $this->attachment_id ); + return ( string ) get_attached_file( $this->attachment_id ); } $metadata = $this->metadata(); @@ -197,7 +208,7 @@ public function ratio() : float { * * @param int $count * @uses static::identify_colors() - * @return array + * @return string[] */ public function colors( int $count = 3 ) : array { $meta = get_post_meta( $this->attachment_id, '_common_colors', true ); @@ -265,12 +276,16 @@ public function output_attributes() : Attributes { /** * Add source attributes. * - * @param $attributes Reference to Attributes object. + * @param Attributes $attributes Reference to Attributes object. * @return void */ protected function output_source_attributes( &$attributes ) : void { $src = wp_get_attachment_image_src( $this->attachment_id, $this->wp_smallest_size ); + if ( empty( $src ) || ! is_array( $src ) ) { + return; + } + $attributes->set( 'src', $src[0] ); $attributes->set( 'width', $src[1] ); $attributes->set( 'height', $src[2] ); diff --git a/includes/types/WP_Theme.php b/includes/types/WP_Theme.php index 31587f4..edd3db1 100644 --- a/includes/types/WP_Theme.php +++ b/includes/types/WP_Theme.php @@ -17,10 +17,13 @@ */ class WP_Theme extends \Image_Tag\Abstracts\WordPress { + /** + * @var string + */ protected $path = null; /** - * @var array Image types. + * @var string[] Image types. */ const TYPES = array( 'theme', @@ -33,8 +36,8 @@ class WP_Theme extends \Image_Tag\Abstracts\WordPress { * Construct. * * @param string $source - * @param null|array|Attributes $attributes - * @param null|array|Settings $settings + * @param null|mixed[]|Attributes $attributes + * @param null|mixed[]|Settings $settings */ public function __construct( string $source, $attributes = null, $settings = null ) { $stylesheet = trailingslashit( get_stylesheet_directory() ); @@ -62,9 +65,7 @@ public function __construct( string $source, $attributes = null, $settings = nul * * @param int $count * @uses static::identify_colors() - * @return array - * - * @todo implement temporary caching + * @return string[] */ public function colors( int $count = 3 ) : array { $cache_key = sprintf( '%s-%d', __FUNCTION__, $count ); @@ -113,6 +114,10 @@ public function ratio() : float { $dimensions = getimagesize( $this->path ); + if ( empty( $dimensions ) ) { + return 0; + } + return absint( $dimensions[0] ) / absint( $dimensions[1] ); } diff --git a/phpstan.neon b/phpstan.neon index 168d201..524c4e1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,3 @@ -includes: - - phpstan-baseline.neon - parameters: level: 8 paths: @@ -8,6 +5,9 @@ parameters: - Plugin.php excludePaths: - vendor + - includes/class-get-image-most-common-colors.php + scanFiles: + - includes/class-get-image-most-common-colors.php bootstrapFiles: - dev/phpstan-bootstrap.php - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php From c4ee13691b284228774c240d55fa89d53b045ec6 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 15:15:16 -0500 Subject: [PATCH 04/13] phpunit migration and fixes --- .gitignore | 3 ++- Plugin.php | 9 +++++++++ composer.lock | 12 ++++++------ phpunit.xml.dist | 17 +++++++++-------- tests/Image_Tag.php | 36 ++++++++++++++++++++++++++++++++++++ tests/Plugin.php | 7 +++++++ tests/bootstrap.php | 2 +- 7 files changed, 70 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 3f48664..1b7cfb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /report /vendor -/.phpstan-cache \ No newline at end of file +/.phpstan-cache +/.phpunit.result.cache diff --git a/Plugin.php b/Plugin.php index 38fdd50..9c30ac4 100644 --- a/Plugin.php +++ b/Plugin.php @@ -69,6 +69,15 @@ public function action__template_redirect() : void { static::include_files(); } + /** + * Action: admin_init + * + * - include files, except for AJAX requests + * + * @uses static::includes() + * + * @codeCoverageIgnore + */ public function action__admin_init() : void { if ( ! wp_doing_ajax() ) { return; diff --git a/composer.lock b/composer.lock index a9350c1..bd8ceb3 100644 --- a/composer.lock +++ b/composer.lock @@ -780,16 +780,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.14", + "version": "1.9.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" + "reference": "922e2689bb180575d0f57de0443c431a5a698e8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/922e2689bb180575d0f57de0443c431a5a698e8f", + "reference": "922e2689bb180575d0f57de0443c431a5a698e8f", "shasum": "" }, "require": { @@ -819,7 +819,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.14" + "source": "https://github.com/phpstan/phpstan/tree/1.9.16" }, "funding": [ { @@ -835,7 +835,7 @@ "type": "tidelift" } ], - "time": "2023-01-19T10:47:09+00:00" + "time": "2023-02-07T10:42:21+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d9e5495..3a838a1 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,15 +27,16 @@ - - + + Plugin.php includes/types/Image_Tag.php - - - - - - + + + + + diff --git a/tests/Image_Tag.php b/tests/Image_Tag.php index fe810d7..6f9eee4 100644 --- a/tests/Image_Tag.php +++ b/tests/Image_Tag.php @@ -9,6 +9,8 @@ class _Image_Tag extends \WP_UnitTestCase { /** * @group constant + * + * @coversNothing */ function test_types() : void { $expected = array( @@ -50,6 +52,13 @@ function creationProvider() : array { $data = array(); + $data['self'] = array( + Image_Tag::class, + Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg' ), + array(), + array() + ); + $data['Image_Tag'] = array( Image_Tag::class, 'https://doesnotexist.com/doesnotexist.jpg', @@ -147,6 +156,9 @@ function creationProvider() : array { return $data; } + /** + * @covers \Image_Tag::output() + */ function test_output() : void { $expected = sprintf( '%s%s', PHP_EOL, PHP_EOL, @@ -202,6 +214,9 @@ protected function _test_output_fallback() : void { $this->assertEquals( $expected, $object->output() ); } + /** + * @covers \Image_Tag::lazyload() + */ function test_lazyload() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', @@ -236,6 +251,9 @@ function test_lazyload() : void { $this->assertEquals( $expected, $object->lazyload() ); } + /** + * @covers \Image_Tag::noscript() + */ function test_noscript() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', @@ -257,11 +275,17 @@ function test_noscript() : void { $this->assertEquals( $expected, $object->noscript() ); } + /** + * @covers \Image_Tag::get_type() + */ function test_get_type() : void { $object = new Image_Tag; $this->assertEquals( 'base', $object->get_type() ); } + /** + * @covers \Image_Tag::is_type() + */ function test_is_type() : void { $object = new Image_Tag; @@ -313,6 +337,9 @@ protected function _test_is_valid_fallback() : void { $this->assertFalse( $object->is_valid( 'base' ) ); } + /** + * @coversNothing + */ function test_joeschmoe() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', array( 'width' => 1600, @@ -337,6 +364,9 @@ function test_joeschmoe() : void { $this->assertNotEquals( $expected, $joeschmoe->output() ); } + /** + * @coversNothing + */ function test_picsum() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', array( 'width' => 1600, @@ -361,6 +391,9 @@ function test_picsum() : void { $this->assertNotEquals( $expected, $picsum->output() ); } + /** + * @coversNothing + */ function test_placeholder() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', array( 'width' => 1600, @@ -385,6 +418,9 @@ function test_placeholder() : void { $this->assertNotEquals( $expected, $placeholder->output() ); } + /** + * @coversNothing + */ function test_unsplash() : void { $object = Image_Tag::create( 'https://doesnotexist.com/doesnotexist.jpg', array( 'width' => 1600, diff --git a/tests/Plugin.php b/tests/Plugin.php index 990a75b..0059547 100755 --- a/tests/Plugin.php +++ b/tests/Plugin.php @@ -21,6 +21,8 @@ static function dir() : string { /** * Test plugin info. + * + * @coversNothing */ function test_info() : void { $data = get_plugin_data( dirname( __DIR__ ) . '/Plugin.php', false, false ); @@ -43,6 +45,8 @@ function test_info() : void { * "RequiresWP" and "RequiresPHP" indexes were added in 5.3.0. * * @link https://developer.wordpress.org/reference/functions/get_plugin_data/ + * + * @coversNothing */ function test_requires_info() : void { require ABSPATH . WPINC . '/version.php'; @@ -60,6 +64,8 @@ function test_requires_info() : void { * Test class constants. * * @group constant + * + * @coversNothing */ function test_constants() : void { $this->assertSame( 2.1, PluginActual::VERSION ); @@ -89,6 +95,7 @@ function test_includes() : void { return ( 0 === stripos( $path, PluginActual::dir() ) && 0 !== stripos( $path, PluginActual::dir() . 'tests/' ) + && 0 !== stripos( $path, PluginActual::dir() . 'vendor/' ) ); } ); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1293be3..6abec81 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -30,5 +30,5 @@ function _manually_load_plugin() { tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); // Start up the WP testing environment. -require '../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; +require dirname( __DIR__ ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; require $_tests_dir . '/includes/bootstrap.php'; From 3eec8c5652537e9e643000edf4ae04182612fead Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 15:52:25 -0500 Subject: [PATCH 05/13] save --- .github/workflows/phpcs.yml | 20 +++++++++++--------- .github/workflows/phpstan.yml | 20 +++++++++++--------- .github/workflows/phpunit.yml | 6 ++++++ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 337f49f..fdb1dbf 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -2,9 +2,17 @@ name: PHPCS run-name: Run PHPCS on `${{ github.head_ref }}` on: + push: + paths: + - Plugin.php + - includes/** + - .github/workflows/phpcs.yml pull_request: paths: - - 'wp-content/themes/familysmiles/**/*.php' + - Plugin.php + - includes/** + - .github/workflows/phpcs.yml + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -24,14 +32,8 @@ jobs: list-files: shell filters: | wpcontent: - - added|modified: 'wp-content/themes/familysmiles/**/*.php' - - added|modified: 'wp-content/mu-plugins/cssllc-acceptable-dynamic-headlines.php' - - added|modified: 'wp-content/mu-plugins/domain-verifications.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-acf-list-columns.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-location.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-service.php' - - added|modified: 'wp-content/mu-plugins/favicons.php' - - added|modified: 'wp-content/mu-plugins/google-tag-manager.php' + - added|modified: 'Plugin.php' + - added|modified: 'includes/**/*.php' - name: Setup PHP if: ${{ steps.filter.outputs.wpcontent == 'true' }} diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 7e8d2aa..66d79a4 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,9 +2,17 @@ name: PHPStan run-name: Run PHPStan on `${{ github.head_ref }}` on: + push: + paths: + - Plugin.php + - includes/** + - .github/workflows/phpstan.yml pull_request: paths: - - 'wp-content/themes/familysmiles/**/*.php' + - Plugin.php + - includes/** + - .github/workflows/phpstan.yml + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -24,14 +32,8 @@ jobs: list-files: shell filters: | wpcontent: - - added|modified: 'wp-content/themes/familysmiles/**/*.php' - - added|modified: 'wp-content/mu-plugins/cssllc-acceptable-dynamic-headlines.php' - - added|modified: 'wp-content/mu-plugins/domain-verifications.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-acf-list-columns.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-location.php' - - added|modified: 'wp-content/mu-plugins/familysmiles-cpt-service.php' - - added|modified: 'wp-content/mu-plugins/favicons.php' - - added|modified: 'wp-content/mu-plugins/google-tag-manager.php' + - added|modified: 'Plugin.php' + - added|modified: 'includes/**/*.php' - name: Setup PHP if: ${{ steps.filter.outputs.wpcontent == 'true' }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index ab48f71..5d5190f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,4 +1,5 @@ name: PHPUnit +run-name: Run PHPUnit on `${{ github.head_ref }}` on: push: @@ -8,6 +9,11 @@ on: - tests/** - .github/workflows/phpunit.yml pull_request: + paths: + - Plugin.php + - includes/** + - tests/** + - .github/workflows/phpunit.yml workflow_dispatch: jobs: From b2fb82e33136a997b1fc493b5cd74a7856d048be Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 15:57:13 -0500 Subject: [PATCH 06/13] save --- .github/workflows/phpcs.yml | 2 ++ .github/workflows/phpstan.yml | 2 ++ .github/workflows/phpunit.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index fdb1dbf..84844c4 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -3,6 +3,8 @@ run-name: Run PHPCS on `${{ github.head_ref }}` on: push: + branches: + - master paths: - Plugin.php - includes/** diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 66d79a4..efd2526 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -3,6 +3,8 @@ run-name: Run PHPStan on `${{ github.head_ref }}` on: push: + branches: + - master paths: - Plugin.php - includes/** diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 5d5190f..30ba81f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -3,6 +3,8 @@ run-name: Run PHPUnit on `${{ github.head_ref }}` on: push: + branches: + - master paths: - Plugin.php - includes/** From 55406a715e3e6b4e3d8218d3efdb4914950fedeb Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 15:58:47 -0500 Subject: [PATCH 07/13] save --- includes/abstracts/WordPress.php | 4 ++-- includes/types/WP_Attachment.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/abstracts/WordPress.php b/includes/abstracts/WordPress.php index a3156b7..a8e2e4a 100644 --- a/includes/abstracts/WordPress.php +++ b/includes/abstracts/WordPress.php @@ -55,8 +55,8 @@ protected static function generate_lqip( string $path ) : string { return ''; } - $size = $editor->get_size(); - $ratio = $size['height'] / $size['width']; + $size = $editor->get_size(); + $ratio = $size['height'] / $size['width']; $resize_width = 20; $resize_height = 20; diff --git a/includes/types/WP_Attachment.php b/includes/types/WP_Attachment.php index 3d2920e..c8280aa 100644 --- a/includes/types/WP_Attachment.php +++ b/includes/types/WP_Attachment.php @@ -25,7 +25,7 @@ class WP_Attachment extends \Image_Tag\Abstracts\WordPress { /** * @var string */ - protected $wp_largest_size = 'thumbnail'; + protected $wp_largest_size = 'thumbnail'; /** * @var string From 6969452202e333ea02776bb1e1226c4868db604e Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 15:59:29 -0500 Subject: [PATCH 08/13] save --- dev/wordpress-overrides.stub | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/dev/wordpress-overrides.stub b/dev/wordpress-overrides.stub index 6bd90b9..1fd6084 100644 --- a/dev/wordpress-overrides.stub +++ b/dev/wordpress-overrides.stub @@ -51,26 +51,4 @@ public function have_posts() { */ function have_rows($selector, $post_id = \false) { -} - -/** - * Retrieves an image to represent an attachment. - * - * @since 2.5.0 - * - * @param int $attachment_id Image attachment ID. - * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of - * width and height values in pixels (in that order). Default 'thumbnail'. - * @param bool $icon Optional. Whether the image should fall back to a mime type icon. Default false. - * @return array|false { - * Array of image data, or boolean false if no image is available. - * - * @type string $0 Image source URL. - * @type int $1 Image width in pixels. - * @type int $2 Image height in pixels. - * @type bool $3 Whether the image is a resized image. - * } - */ -function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) -{ } \ No newline at end of file From ec2fb716b63f785b7efd0654a80c83c314457396 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 16:03:43 -0500 Subject: [PATCH 09/13] save --- .github/workflows/phpunit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 30ba81f..553b293 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -44,7 +44,7 @@ jobs: WP_MULTISITE: '0' steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -61,7 +61,7 @@ jobs: - name: Get Composer cache directory working-directory: ./tests id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Set up Composer caching uses: actions/cache@v3.2.4 From a04208d63bb884fe8380848fbe5956b38ff2cbad Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 16:07:05 -0500 Subject: [PATCH 10/13] save --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 553b293..83c442f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -59,7 +59,7 @@ jobs: run: php -v - name: Get Composer cache directory - working-directory: ./tests + working-directory: ./ id: composer-cache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT From 533df2a9c4eeeef9f9b5adb30c60a377334af23d Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 16:07:44 -0500 Subject: [PATCH 11/13] save --- .github/workflows/phpunit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 83c442f..b234b8c 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -59,7 +59,6 @@ jobs: run: php -v - name: Get Composer cache directory - working-directory: ./ id: composer-cache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT @@ -74,7 +73,6 @@ jobs: ${{ runner.os }}-composer- - name: Composer install - working-directory: ./tests run: composer install --optimize-autoloader --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction - name: Install WP Tests From 4ba4c46789e00e571f10d1b98863b39982129710 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 16:11:14 -0500 Subject: [PATCH 12/13] save --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b234b8c..cfdf13c 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.4'] + php-versions: ['8.1'] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} services: mysql: From 94c0e76b9a9f7ddd1311858035428c045acca5f7 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Tue, 7 Feb 2023 16:12:51 -0500 Subject: [PATCH 13/13] save --- .github/workflows/phpunit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index cfdf13c..bfe958e 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,7 +53,6 @@ jobs: ini-values: post_max_size=256M coverage: xdebug #optional, setup coverage driver extensions: mysqli, mbstring, intl - tools: composer:v1 - name: Check PHP Version run: php -v