diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 161b444..83ae310 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,93 +1,45 @@ -name: Continuous integration checks +name: Continuous Integration on: - # Run on PRs and pushes, only on significant changes. push: branches: - - develop - - main + - "develop" + - "main" paths-ignore: - - '**.md' + - "**.md" pull_request: paths-ignore: - - '**.md' + - "**.md" -# Prevent multiple unnecessary CI runs on the same branch. -# Link: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: "${{ github.workflow }}-${{ github.ref }}" cancel-in-progress: true jobs: - phpcs: - name: PHPCS check on PHP ${{ matrix.php }} + phpstan: + name: PHP static code analysis using PHP - ${{ matrix.php }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - php: [ '7.4' ] - + php: [ '8.2', '8.3' ] steps: - # Checkout repository - - name: Checkout - uses: actions/checkout@v2 - - # Setup PHP versions, run checks - - name: PHP setup - uses: shivammathur/setup-php@v2 + - name: PHP Static code analysis + uses: infinum/eightshift-deploy-actions-public/.github/actions/lint-php-static@main with: - php-version: ${{ matrix.php }} - coverage: none - tools: cs2pr - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Install dependencies and handle caching in one go. - # @link https://github.com/marketplace/actions/install-composer-dependencies - - name: Install Composer dependencies - uses: ramsey/composer-install@v2 - with: - dependency-versions: highest - ignore-cache: "yes" - - - name: Check coding standards using PHPCS - continue-on-error: true - run: composer test:standards -- --runtime-set testVersion ${{ matrix.php }}- --report-full --report-checkstyle=./phpcs-report.xml - - - name: Show PHPCS results in PR - run: cs2pr ./phpcs-report.xml + PHP_VERSION: ${{ matrix.php }} + PROJECT_PATH: '' - phpstan: - name: PHPStan check + phpcs: + name: PHP check coding standards using PHP - ${{ matrix.php }} runs-on: ubuntu-latest - continue-on-error: ${{ matrix.allowed_failure }} strategy: fail-fast: false matrix: - php: [ '7.4' ] - allowed_failure: [ true ] - + php: [ '8.2', '8.3' ] steps: - # Checkout repository - - name: Checkout - uses: actions/checkout@v2 - - # Setup PHP versions, run checks - - name: PHP setup - uses: shivammathur/setup-php@v2 + - name: PHP check coding standards + uses: infinum/eightshift-deploy-actions-public/.github/actions/lint-php@main with: - php-version: ${{ matrix.php }} - coverage: none - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Install dependencies and handle caching in one go. - # @link https://github.com/marketplace/actions/install-composer-dependencies - - name: Install Composer dependencies - uses: ramsey/composer-install@v2 - with: - dependency-versions: highest - ignore-cache: "yes" - - - name: Check code consistency using PHPStan - run: composer test:types + PHP_VERSION: ${{ matrix.php }} + PROJECT_PATH: '' diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f6c80..fc1da0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/). +## [2.0.0] + +### Updated +- `eightshift-forms-utils` to version `2.0.0`. +- `@infinum/eightshift-libs` to version `8.0.0`. + +### Removed +- `MAIN_PLUGIN_MANIFEST_ITEM_HOOK_NAME` constant. +- `getDataManifest`, `getDataManifestRaw`, `getProjectVersion`, `getCountrySelectList` functions. +- `src/Manifest/UtilsManifest.php` class. + +### Changed +- `getDataManifestPath` helper now supports only `$path` param. +- `camelToSnakeCase`, `kebabToSnakeCase`, `recursiveFind`, `getCurrentUrl`, `cleanPageUrl` are now used from the `@infinum/eightshift-libs` package. +- Minimum PHP version is now `8.2`. + ## [1.3.5] ### Fixed @@ -136,6 +152,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a - Initial production release. +[2.0.0]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.5...2.0.0 [1.3.5]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.4...1.3.5 [1.3.4]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.3...1.3.4 [1.3.3]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.2...1.3.3 diff --git a/README.md b/README.md index b84f966..b3fac47 100644 --- a/README.md +++ b/README.md @@ -39,4 +39,4 @@ When submitting issues or otherwise participating in development, please follow Eightshift Forms is maintained and sponsored by [Infinum](https://infinum.com). ## ⚖️ License -Eightshift Forms ©2024 [Infinum](https://infinum.com). It is free software, and may be redistributed under the terms specified in the LICENSE file. +Eightshift Forms [Infinum](https://infinum.com). It is free software, and may be redistributed under the terms specified in the LICENSE file. diff --git a/composer.json b/composer.json index d93369b..ae4f59a 100644 --- a/composer.json +++ b/composer.json @@ -27,14 +27,15 @@ "source": "https://github.com/infinum/eightshift-forms" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", - "infinum/eightshift-coding-standards": "^1.6", + "dealerdirect/phpcodesniffer-composer-installer": "^v1.0.0", + "infinum/eightshift-coding-standards": "2.0.0-beta", + "php-parallel-lint/php-parallel-lint": "^1.3", "php-stubs/wordpress-stubs": "^6.3", "szepeviktor/phpstan-wordpress": "^1.3" }, "require": { - "php": "^7.4 || >=8.0", - "infinum/eightshift-libs": "^7.1.2" + "php": ">=8.2", + "infinum/eightshift-libs": "dev-develop" }, "suggest": { "ext-pcov": "* || This extension is used for code coverage generation. Use either pcov, or xdebug, but not both.", @@ -57,8 +58,8 @@ }, "scripts": { "test:types": "@php ./vendor/bin/phpstan analyze", - "test:standards": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-", - "standards:fix": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --runtime-set testVersion 7.4-", + "test:standards": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 8.2-", + "standards:fix": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --runtime-set testVersion 8.2-", "test": [ "@test:standards", "@test:types" diff --git a/composer.lock b/composer.lock index 12ae524..2f87a91 100644 --- a/composer.lock +++ b/composer.lock @@ -4,48 +4,45 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ea51f3a78024996efb10cc6574a303bf", + "content-hash": "475ccaf428f96c3cce3f7ada5f094f0e", "packages": [ { "name": "infinum/eightshift-libs", - "version": "7.1.2", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/infinum/eightshift-libs.git", - "reference": "a5f24a4a5450089fc0ccb2bd06661d6ca59639f8" + "reference": "249a574558abafb9a98d4935577bbe5687ef4eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinum/eightshift-libs/zipball/a5f24a4a5450089fc0ccb2bd06661d6ca59639f8", - "reference": "a5f24a4a5450089fc0ccb2bd06661d6ca59639f8", + "url": "https://api.github.com/repos/infinum/eightshift-libs/zipball/249a574558abafb9a98d4935577bbe5687ef4eca", + "reference": "249a574558abafb9a98d4935577bbe5687ef4eca", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", - "php": "^7.4 || >=8.0", + "php": ">=8.2", "php-di/invoker": "^2.3.4", "php-di/php-di": "^7" }, "require-dev": { - "brain/monkey": "^2.6.1", "captainhook/captainhook": "^5.10", "dealerdirect/phpcodesniffer-composer-installer": "^v1.0.0", "infinum/eightshift-coding-standards": "2.0.0-beta", - "pestphp/pest": "^1.20", "php-parallel-lint/php-parallel-lint": "^1.3", "php-stubs/wordpress-stubs": "^6.3", "roave/security-advisories": "dev-master", "szepeviktor/phpstan-wordpress": "^1.3", - "wp-cli/wp-cli": "^2.9", - "yoast/wp-test-utils": "^1.0" + "wp-cli/wp-cli": "^2.9" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { - "EightshiftLibs\\": "src/", - "EightshiftBoilerplate\\": "src/" + "EightshiftLibs\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -74,41 +71,40 @@ "issues": "https://github.com/infinum/eightshift-libs/issues", "source": "https://github.com/infinum/eightshift-libs" }, - "time": "2024-01-15T14:07:46+00:00" + "time": "2024-05-17T08:39:27+00:00" }, { - "name": "opis/closure", - "version": "3.6.3", + "name": "laravel/serializable-closure", + "version": "v1.3.3", "source": { "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + "url": "https://github.com/laravel/serializable-closure.git", + "reference": "3dbf8a8e914634c48d389c1234552666b3d43754" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754", + "reference": "3dbf8a8e914634c48d389c1234552666b3d43754", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0" + "php": "^7.3|^8.0" }, "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "nesbot/carbon": "^2.61", + "pestphp/pest": "^1.21.3", + "phpstan/phpstan": "^1.8.2", + "symfony/var-dumper": "^5.4.11" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.6.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { - "files": [ - "functions.php" - ], "psr-4": { - "Opis\\Closure\\": "src/" + "Laravel\\SerializableClosure\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -117,29 +113,25 @@ ], "authors": [ { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" }, { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" + "name": "Nuno Maduro", + "email": "nuno@laravel.com" } ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", + "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", "keywords": [ - "anonymous functions", "closure", - "function", - "serializable", - "serialization", - "serialize" + "laravel", + "serializable" ], "support": { - "issues": "https://github.com/opis/closure/issues", - "source": "https://github.com/opis/closure/tree/3.6.3" + "issues": "https://github.com/laravel/serializable-closure/issues", + "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-01-27T09:35:39+00:00" + "time": "2023-11-08T14:08:06+00:00" }, { "name": "php-di/invoker", @@ -198,39 +190,36 @@ }, { "name": "php-di/php-di", - "version": "7.0.0-beta3", + "version": "7.0.6", "source": { "type": "git", "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "5762e370a49c5e74e51be2910ab1ffb1f856fe6b" + "reference": "8097948a89f6ec782839b3e958432f427cac37fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/5762e370a49c5e74e51be2910ab1ffb1f856fe6b", - "reference": "5762e370a49c5e74e51be2910ab1ffb1f856fe6b", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd", + "reference": "8097948a89f6ec782839b3e958432f427cac37fd", "shasum": "" }, "require": { - "opis/closure": "^3.5.5", - "php": ">=7.2.0", + "laravel/serializable-closure": "^1.0", + "php": ">=8.0", "php-di/invoker": "^2.0", - "php-di/phpdoc-reader": "^2.0.1", - "psr/container": "^1.0" + "psr/container": "^1.1 || ^2.0" }, "provide": { "psr/container-implementation": "^1.0" }, "require-dev": { - "doctrine/annotations": "~1.2", - "friendsofphp/php-cs-fixer": "^2.4", - "mnapoli/phpunit-easymock": "^1.2", - "ocramius/proxy-manager": "^2.0.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8.5|^9.0" + "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/proxy-manager-lts": "^1", + "mnapoli/phpunit-easymock": "^1.3", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.6" }, "suggest": { - "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", - "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~2.0)" + "friendsofphp/proxy-manager-lts": "Install it if you want to use lazy injection (version ^1)" }, "type": "library", "autoload": { @@ -258,7 +247,7 @@ ], "support": { "issues": "https://github.com/PHP-DI/PHP-DI/issues", - "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.0-beta3" + "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6" }, "funding": [ { @@ -270,68 +259,31 @@ "type": "tidelift" } ], - "time": "2021-03-06T20:32:01+00:00" - }, - { - "name": "php-di/phpdoc-reader", - "version": "2.2.1", - "source": { - "type": "git", - "url": "https://github.com/PHP-DI/PhpDocReader.git", - "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/66daff34cbd2627740ffec9469ffbac9f8c8185c", - "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "require-dev": { - "mnapoli/hard-mode": "~0.3.0", - "phpunit/phpunit": "^8.5|^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "PhpDocReader\\": "src/PhpDocReader" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", - "keywords": [ - "phpdoc", - "reflection" - ], - "support": { - "issues": "https://github.com/PHP-DI/PhpDocReader/issues", - "source": "https://github.com/PHP-DI/PhpDocReader/tree/2.2.1" - }, - "time": "2020-10-12T12:39:22+00:00" + "time": "2023-11-02T10:04:50+00:00" }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -358,43 +310,46 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" } ], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -410,7 +365,7 @@ }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -434,39 +389,36 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "infinum/eightshift-coding-standards", - "version": "1.6.0", + "version": "2.0.0-beta", "source": { "type": "git", "url": "https://github.com/infinum/eightshift-coding-standards.git", - "reference": "9441a91fe334258886a443e2236f6f07b1f5c17d" + "reference": "57719e1c758e48129b5fd03a88859b7f4afa2dd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinum/eightshift-coding-standards/zipball/9441a91fe334258886a443e2236f6f07b1f5c17d", - "reference": "9441a91fe334258886a443e2236f6f07b1f5c17d", + "url": "https://api.github.com/repos/infinum/eightshift-coding-standards/zipball/57719e1c758e48129b5fd03a88859b7f4afa2dd9", + "reference": "57719e1c758e48129b5fd03a88859b7f4afa2dd9", "shasum": "" }, "require": { - "php": "^7.2", - "phpcompatibility/phpcompatibility-wp": "^2.1.1", - "phpcsstandards/phpcsextra": "^1.0", - "phpcsstandards/phpcsutils": "^1.0", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.6.0", - "wp-coding-standards/wpcs": "^2.3.0" + "php": ">=7.4", + "phpcompatibility/phpcompatibility-wp": "^2.1.4", + "slevomat/coding-standard": "^8.13.0", + "wp-coding-standards/wpcs": "dev-hotifx/escape-output-sniff" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", - "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^7.0", "roave/security-advisories": "dev-master" }, "type": "phpcodesniffer-standard", @@ -497,20 +449,81 @@ "issues": "https://github.com/infinum/eightshift-coding-standards/issues", "source": "https://github.com/infinum/eightshift-coding-standards" }, - "time": "2022-07-05T14:21:49+00:00" + "time": "2023-09-22T13:43:43+00:00" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.3.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", + "squizlabs/php_codesniffer": "^3.6" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool checks the syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "keywords": [ + "lint", + "static analysis" + ], + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", + "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.4.0" + }, + "time": "2024-03-27T12:14:49+00:00" }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.4.1", + "version": "v6.5.3", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b" + "reference": "e611a83292d02055a25f83291a98fadd0c21e092" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6d6063cf9464a306ca2a0529705d41312b08500b", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/e611a83292d02055a25f83291a98fadd0c21e092", + "reference": "e611a83292d02055a25f83291a98fadd0c21e092", "shasum": "" }, "require-dev": { @@ -518,10 +531,10 @@ "nikic/php-parser": "^4.13", "php": "^7.4 || ~8.0.0", "php-stubs/generator": "^0.8.3", - "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpstan": "^1.10.12", + "phpdocumentor/reflection-docblock": "5.3", + "phpstan/phpstan": "^1.10.49", "phpunit/phpunit": "^9.5", - "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.11" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -542,9 +555,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.4.1" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.5.3" }, - "time": "2023-11-10T00:33:47+00:00" + "time": "2024-05-08T02:12:31+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -610,28 +623,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "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.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || 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", @@ -661,22 +674,37 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2022-10-25T01:46:02+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -684,10 +712,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || 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", @@ -716,9 +744,24 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" }, { "name": "phpcsstandards/phpcsextra", @@ -800,22 +843,22 @@ }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.9", + "version": "1.0.11", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "908247bc65010c7b7541a9551e002db12e9dae70" + "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70", - "reference": "908247bc65010c7b7541a9551e002db12e9dae70", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c457da9dabb60eb7106dd5e3c05132b1a6539c6a", + "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.9.0 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", @@ -884,20 +927,20 @@ "type": "open_collective" } ], - "time": "2023-12-08T14:50:00+00:00" + "time": "2024-04-24T11:47:18+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.25.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", "shasum": "" }, "require": { @@ -929,22 +972,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" }, - "time": "2024-01-04T17:06:16+00:00" + "time": "2024-05-06T12:04:23+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", "shasum": "" }, "require": { @@ -987,52 +1030,48 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-05-15T08:00:59+00:00" }, { "name": "slevomat/coding-standard", - "version": "7.2.1", + "version": "8.15.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + "reference": "7d1d957421618a3803b593ec31ace470177d7817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.5.1", - "squizlabs/php_codesniffer": "^3.6.2" + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.1", - "phpstan/phpstan-deprecation-rules": "1.0.0", - "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan": "1.10.60", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.16", + "phpstan/phpstan-strict-rules": "1.5.2", + "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { "psr-4": { - "SlevomatCodingStandard\\": "SlevomatCodingStandard" + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1040,9 +1079,13 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" }, "funding": [ { @@ -1054,20 +1097,20 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2024-03-09T15:20:58+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.0", + "version": "3.9.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { @@ -1077,11 +1120,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -1134,20 +1177,20 @@ "type": "open_collective" } ], - "time": "2023-12-08T12:32:31+00:00" + "time": "2024-04-23T20:25:34+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -1155,9 +1198,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1197,7 +1237,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -1213,26 +1253,26 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v1.3.2", + "version": "v1.3.4", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a" + "reference": "891d0767855a32c886a439efae090408cc1fa156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/b8516ed6bab7ec50aae981698ce3f67f1be2e45a", - "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/891d0767855a32c886a439efae090408cc1fa156", + "reference": "891d0767855a32c886a439efae090408cc1fa156", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", - "phpstan/phpstan": "^1.10.30", + "phpstan/phpstan": "^1.10.31", "symfony/polyfill-php73": "^1.12.0" }, "require-dev": { @@ -1273,36 +1313,44 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.2" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.4" }, - "time": "2023-10-16T17:23:56+00:00" + "time": "2024-03-21T16:32:59+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "dev-hotifx/escape-output-sniff", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "4a4849258060bd74bb396f00dd3771510949314b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/4a4849258060bd74bb396f00dd3771510949314b", + "reference": "4a4849258060bd74bb396f00dd3771510949314b", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -1319,6 +1367,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -1326,16 +1375,24 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-22T11:39:02+00:00" } ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "infinum/eightshift-libs": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.4 || >=8.0" + "php": ">=8.2" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 6e8e868..08cdea7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -19,10 +19,10 @@ . - + - + /src/CompiledContainer\.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6ad6ede..4160a79 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,4 +10,6 @@ parameters: - src/ excludePaths: - src/**/*Example.php - checkGenericClassInNonGenericObjectType: false + ignoreErrors: + - identifier: missingType.generics + diff --git a/src/Config/UtilsConfig.php b/src/Config/UtilsConfig.php index b2d7ae6..52cb178 100644 --- a/src/Config/UtilsConfig.php +++ b/src/Config/UtilsConfig.php @@ -180,11 +180,11 @@ class UtilsConfig // ------------------------------------------------------------------ /** - * Main plugin manifest item hook name. + * Main plugin manifest cache name. * * @var string */ - public const MAIN_PLUGIN_MANIFEST_ITEM_HOOK_NAME = 'es-forms-manifest-item'; + public const MAIN_PLUGIN_MANIFEST_CACHE_NAME = 'es_forms'; // ------------------------------------------------------------------ // DEVELOPER diff --git a/src/Data/country/manifest.json b/src/Data/countries/manifest.json similarity index 100% rename from src/Data/country/manifest.json rename to src/Data/countries/manifest.json diff --git a/src/Helpers/UtilsApiHelper.php b/src/Helpers/UtilsApiHelper.php index cb084f5..bac24d7 100644 --- a/src/Helpers/UtilsApiHelper.php +++ b/src/Helpers/UtilsApiHelper.php @@ -11,7 +11,7 @@ namespace EightshiftFormsUtils\Helpers; use EightshiftFormsUtils\Config\UtilsConfig; -use EightshiftLibs\Helpers\Components; +use EightshiftLibs\Helpers\Helpers; /** * UtilsApiHelper class. @@ -61,7 +61,7 @@ public static function getIntegrationApiReponseDetails( $code = $response['response']['code'] ?? UtilsConfig::API_RESPONSE_CODE_SUCCESS; $body = $response['body'] ?? ''; - if (Components::isJson($body)) { + if (Helpers::isJson($body)) { $body = \json_decode($body, true) ?? []; } } diff --git a/src/Helpers/UtilsDataHelper.php b/src/Helpers/UtilsDataHelper.php index b6e3f1c..54b40f9 100644 --- a/src/Helpers/UtilsDataHelper.php +++ b/src/Helpers/UtilsDataHelper.php @@ -10,62 +10,22 @@ namespace EightshiftFormsUtils\Helpers; -use EightshiftLibs\Helpers\Components; +use EightshiftLibs\Helpers\Helpers; /** * Class UtilsDataHelper */ final class UtilsDataHelper { - /** - * Return files from data folder. - * - * @param string $type Folder name. - * @param string $file File name with ext. - * - * @return array - */ - public static function getDataManifest(string $type, string $file = 'manifest.json'): array - { - $path = self::getDataManifestRaw($type, $file); - - if ($path) { - return \json_decode($path, true); - } - - return []; - } - - /** - * Return files from data folder in raw format. - * - * @param string $type Folder name. - * @param string $file File name with ext. - * - * @return string - */ - public static function getDataManifestRaw(string $type, string $file = 'manifest.json'): string - { - $path = self::getDataManifestPath($type, $file); - - if (\file_exists($path)) { - return \file_get_contents($path); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents - } - - return ''; - } - /** * Return files full path. * - * @param string $type Folder name. - * @param string $file File name with ext. + * @param string $path Path to the file. * * @return string */ - public static function getDataManifestPath(string $type, string $file = 'manifest.json'): string + public static function getDataManifestPath(string $path): string { - $sep = \DIRECTORY_SEPARATOR; - return Components::getProjectPaths('srcPath') . "vendor-prefixed/infinum/eightshift-forms-utils{$sep}src{$sep}Data{$sep}{$type}{$sep}{$file}"; + return Helpers::joinPaths([Helpers::getProjectPaths('pluginRoot'), 'vendor-prefixed', 'infinum', 'eightshift-forms-utils', 'src', 'Data', $path]); } } diff --git a/src/Helpers/UtilsGeneralHelper.php b/src/Helpers/UtilsGeneralHelper.php index adf9e24..0322a58 100644 --- a/src/Helpers/UtilsGeneralHelper.php +++ b/src/Helpers/UtilsGeneralHelper.php @@ -11,33 +11,13 @@ namespace EightshiftFormsUtils\Helpers; use EightshiftFormsUtils\Config\UtilsConfig; -use EightshiftLibs\Helpers\Components; -use RecursiveArrayIterator; -use RecursiveIteratorIterator; +use EightshiftLibs\Helpers\Helpers; /** * UtilsGeneralHelper class. */ final class UtilsGeneralHelper { - /** - * Method that returns project version. - * - * Generally used for versioning asset handlers while enqueueing them. - * - * @return string - */ - public static function getProjectVersion(): string - { - if (!\function_exists('get_plugin_data')) { - require_once(\ABSPATH . 'wp-admin/includes/plugin.php'); - } - - $details = \get_plugin_data(Components::getProjectPaths('cliOutput') . \DIRECTORY_SEPARATOR . UtilsConfig::MAIN_PLUGIN_FILE_NAME); - - return isset($details['Version']) ? (string) $details['Version'] : '1.0.0'; - } - /** * Method that returns listing page url. * @@ -242,34 +222,10 @@ public static function getBlockNameDetails(string $blockName): array return [ 'namespace' => $block[0] ?? '', 'name' => $blockName, - 'nameAttr' => Components::kebabToCamelCase($blockName), + 'nameAttr' => Helpers::kebabToCamelCase($blockName), ]; } - /** - * Convert camel to snake case - * - * @param string $input Name to change. - * - * @return string - */ - public static function camelToSnakeCase($input): string - { - return \strtolower((string) \preg_replace('/(?> - */ - public static function getCountrySelectList(): array - { - return UtilsDataHelper::getDataManifest('country'); - } - /** * Output additional content from filter by block. * Limited to front page only. @@ -659,29 +605,6 @@ public static function getBlockAdditionalContentViaFilter(string $name, array $a return ''; } - /** - * Find array value by key in recursive array. - * - * @param array $array Array to find. - * @param string $needle Key name to find. - * - * @return array - */ - public static function recursiveFind(array $array, string $needle): array - { - $iterator = new RecursiveArrayIterator($array); - $recursive = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST); - $aHitList = []; - - foreach ($recursive as $key => $value) { - if ($key === $needle) { - \array_push($aHitList, $value); - } - } - - return $aHitList; - } - /** * Output select options ass array from html string. * @@ -738,20 +661,6 @@ public static function isBlockEditor(): bool return $currentScreen->is_block_editor(); } - /** - * Get current url with params. - * - * @return string - */ - public static function getCurrentUrl(): string - { - $port = isset($_SERVER['HTTPS']) ? \sanitize_text_field(\wp_unslash($_SERVER['HTTPS'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended - $host = isset($_SERVER['HTTP_HOST']) ? \sanitize_text_field(\wp_unslash($_SERVER['HTTP_HOST'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended - $request = isset($_SERVER['REQUEST_URI']) ? \sanitize_text_field(\wp_unslash($_SERVER['REQUEST_URI'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended - - return ($port ? "https" : "http") . "://{$host}{$request}"; - } - /** * Remove unecesery custom params. * @@ -762,7 +671,7 @@ public static function getCurrentUrl(): string */ public static function removeUneceseryParamFields(array $params, array $additional = []): array { - $customFields = \array_flip(Components::flattenArray(UtilsHelper::getStateParams())); + $customFields = \array_flip(Helpers::flattenArray(UtilsHelper::getStateParams())); $additional = \array_flip($additional); return \array_filter( @@ -793,18 +702,6 @@ public static function canIntegrationUseSync(string $integrationName): bool return isset(\apply_filters(UtilsConfig::FILTER_SETTINGS_DATA, [])[$integrationName]['fields']); } - /** - * Clean url from query params. - * - * @param string $url Url to clean. - * - * @return string - */ - public static function cleanPageUrl(string $url): string - { - return \preg_replace('/\\?.*/', '', $url); - } - /** * Return all posts where form is assigned. * diff --git a/src/Helpers/UtilsHelper.php b/src/Helpers/UtilsHelper.php index 9d51d30..bed6f43 100644 --- a/src/Helpers/UtilsHelper.php +++ b/src/Helpers/UtilsHelper.php @@ -10,7 +10,7 @@ namespace EightshiftFormsUtils\Helpers; -use EightshiftLibs\Helpers\Components; +use EightshiftLibs\Helpers\Helpers; /** * UtilsHelper class. @@ -39,7 +39,7 @@ public static function getUtilsManifest(): array */ public static function getUtilsIcons(string $type): string { - return self::getUtilsManifest()['icons'][Components::kebabToCamelCase($type)] ?? ''; + return self::getUtilsManifest()['icons'][Helpers::kebabToCamelCase($type)] ?? ''; } /** diff --git a/src/Helpers/UtilsHooksHelper.php b/src/Helpers/UtilsHooksHelper.php index 33f1a6b..1d394b8 100644 --- a/src/Helpers/UtilsHooksHelper.php +++ b/src/Helpers/UtilsHooksHelper.php @@ -11,6 +11,7 @@ namespace EightshiftFormsUtils\Helpers; use EightshiftFormsUtils\Config\UtilsConfig; +use EightshiftLibs\Helpers\Helpers; /** * Class UtilsHooksHelper @@ -78,7 +79,7 @@ private static function getHookName(array $names, string $cacheName, string $lab // List of all keys provided for the filter name. $names = \array_map( function ($item) { - return UtilsGeneralHelper::kebabToSnakeCase(UtilsGeneralHelper::camelToSnakeCase($item)); + return Helpers::kebabToSnakeCase(Helpers::camelToSnakeCase($item)); }, $names ); @@ -113,10 +114,10 @@ private static function getHooksList(array $data, string $prefix = '', string $f foreach ($data as $key => $value) { if (\is_array($value)) { - $nestedKeys = self::getHooksList($value, $prefix . UtilsGeneralHelper::kebabToSnakeCase(UtilsGeneralHelper::camelToSnakeCase($key)) . '_', $filterPrefix); + $nestedKeys = self::getHooksList($value, $prefix . Helpers::kebabToSnakeCase(Helpers::camelToSnakeCase($key)) . '_', $filterPrefix); $output = \array_merge($output, $nestedKeys); } else { - $output[] = $filterPrefix . '_' . $prefix . UtilsGeneralHelper::kebabToSnakeCase(UtilsGeneralHelper::camelToSnakeCase($value)); + $output[] = $filterPrefix . '_' . $prefix . Helpers::kebabToSnakeCase(Helpers::camelToSnakeCase($value)); } } diff --git a/src/Helpers/UtilsUploadHelper.php b/src/Helpers/UtilsUploadHelper.php index 8f18eac..4ee66d5 100644 --- a/src/Helpers/UtilsUploadHelper.php +++ b/src/Helpers/UtilsUploadHelper.php @@ -100,7 +100,7 @@ public static function uploadFile(array $file): array } if (!\is_dir($folderPath)) { - $newFolder = \mkdir($folderPath); + $newFolder = \mkdir($folderPath); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir if (!$newFolder) { return \array_merge( @@ -173,7 +173,7 @@ public static function deleteFiles(array $files): void foreach ($items as $file) { if (\file_exists($file['path'])) { - \unlink($file['path']); + \unlink($file['path']); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir, WordPress.WP.AlternativeFunctions.unlink_unlink } } } @@ -210,7 +210,7 @@ public static function deleteUploadFolderContent(int $numberOfHours = 2): void } // Remove old files. - \unlink($file); + \unlink($file); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir, WordPress.WP.AlternativeFunctions.unlink_unlink } } diff --git a/src/Manifest/UtilsManifest.php b/src/Manifest/UtilsManifest.php deleted file mode 100644 index de3c964..0000000 --- a/src/Manifest/UtilsManifest.php +++ /dev/null @@ -1,43 +0,0 @@ -