diff --git a/composer.json b/composer.json index 5010027..8550d9f 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "composer/installers": "^1.5|^2" }, "require-dev": { - "itinerisltd/itineris-wp-coding-standards": "^0.4.0", + "itinerisltd/itineris-wp-coding-standards": "^1.0.0", "roave/security-advisories": "dev-master" }, "config": { diff --git a/composer.lock b/composer.lock index 22cc759..8b727dc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4c9962b0cb85a63d8bed0f11f763ec92", + "content-hash": "340cde6fb36c88efc1c691cfe0cd4dba", "packages": [ { "name": "composer/installers", @@ -155,35 +155,38 @@ "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/", @@ -199,7 +202,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", @@ -223,28 +226,29 @@ "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": "itinerisltd/itineris-wp-coding-standards", - "version": "0.4.1", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/ItinerisLtd/itineris-wp-coding-standards.git", - "reference": "f74a6c9e05638d7eafd54b6f7f8f5ff3a3ebc05e" + "reference": "dff4d7d34ca2f73e306b8c07991525518639566b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ItinerisLtd/itineris-wp-coding-standards/zipball/f74a6c9e05638d7eafd54b6f7f8f5ff3a3ebc05e", - "reference": "f74a6c9e05638d7eafd54b6f7f8f5ff3a3ebc05e", + "url": "https://api.github.com/repos/ItinerisLtd/itineris-wp-coding-standards/zipball/dff4d7d34ca2f73e306b8c07991525518639566b", + "reference": "dff4d7d34ca2f73e306b8c07991525518639566b", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", - "php": "^7.2 || ^8.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php": "^8.1", + "slevomat/coding-standard": "^8.8", "wp-coding-standards/wpcs": "^2.3" }, "require-dev": { @@ -293,7 +297,54 @@ "issues": "https://github.com/ItinerisLtd/itineris-wp-coding-standards/issues", "source": "https://github.com/ItinerisLtd/itineris-wp-coding-standards" }, - "time": "2022-09-01T11:39:40+00:00" + "time": "2023-04-17T13:17:20+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.29.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "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.29.1" + }, + "time": "2024-05-31T08:52:43+00:00" }, { "name": "roave/security-advisories", @@ -926,18 +977,83 @@ ], "time": "2023-07-11T01:32:50+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "8.15.0", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "7d1d957421618a3803b593ec31ace470177d7817" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.9.0" + }, + "require-dev": { + "phing/phing": "2.17.4", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "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": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "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/8.15.0" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2024-03-09T15:20:58+00:00" + }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.10.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -947,11 +1063,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -966,22 +1082,45 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-05-22T21:24:41+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/src/AbstractBladeBlock.php b/src/AbstractBladeBlock.php index 4cfedc6..42a6835 100755 --- a/src/AbstractBladeBlock.php +++ b/src/AbstractBladeBlock.php @@ -17,7 +17,7 @@ public function getBladeEngineCallable(): string 'acf_gutenblocks/blade_engine_callable', '\App\template', "{$this->dir}/views/frontend{$this->fileExtension()}", - $this + $this, ); } @@ -31,7 +31,7 @@ public function renderBlockCallback(array $block): void $frontend = apply_filters( 'acf_gutenblocks/render_block_frontend_path', "{$this->dir}/views/frontend{$this->fileExtension()}", - $this + $this, ); $block['slug'] = str_replace('acf/', '', $block['name']); diff --git a/src/AbstractBlock.php b/src/AbstractBlock.php index df07c32..a5661f2 100644 --- a/src/AbstractBlock.php +++ b/src/AbstractBlock.php @@ -21,7 +21,7 @@ public function renderBlockCallback(array $block): void $frontend = apply_filters( 'acf_gutenblocks/render_block_frontend_path', "{$this->dir}/views/frontend{$this->fileExtension()}", - $this + $this, ); if (file_exists($frontend)) { diff --git a/src/Block.php b/src/Block.php index 68e0ad5..be181e2 100644 --- a/src/Block.php +++ b/src/Block.php @@ -10,105 +10,92 @@ class Block * The directory name of the block. * * @since 0.1.0 - * @var string $name */ - protected $name = ''; + protected string $name = ''; /** * The display name of the block. * * @since 0.1.0 - * @var string $title */ - protected $title = ''; + protected string $title = ''; /** * The description of the block. * * @since 0.1.0 - * @var string $description */ - protected $description; + protected string $description; /** * The category this block belongs to. * * @since 0.1.0 - * @var string $category */ - protected $category; + protected string $category; /** * The icon of this block. * * @since 0.1.0 - * @var string $icon */ - protected $icon = ''; + protected string $icon = ''; /** * An array of keywords the block will be found under. * * @since 0.1.0 - * @var array $keywords */ - protected $keywords = []; + protected array $keywords = []; /** * An array of Post Types the block will be available to. * * @since 0.1.0 - * @var array $post_types */ - protected $post_types = ['post', 'page']; + protected array $post_types = ['post', 'page']; /** * The default display mode of the block that is shown to the user. * * @since 0.1.0 - * @var string $mode */ - protected $mode = 'preview'; + protected string $mode = 'preview'; /** * The block alignment class. * * @since 0.1.0 - * @var string $align */ - protected $align = ''; + protected string $align = ''; /** * Features supported by the block. * * @since 0.1.0 - * @var array $supports */ - protected $supports = []; + protected array $supports = []; /** * The blocks directory path. * * @since 0.1.0 - * @var string $dir */ - public $dir; + public string $dir; /** * The blocks accessibility. * * @since 0.1.0 - * @var boolean $enabled */ - protected $enabled = true; + protected bool $enabled = true; /** * The blocks fields. * * @since 0.6.0 - * @var array $fields */ - protected $fields = []; + protected array $fields = []; /** * Begin block construction! @@ -153,7 +140,6 @@ public function __construct(array $settings) * Is the block enabled? * * @since 0.1.0 - * @return boolean */ public function isEnabled(): bool { @@ -164,7 +150,6 @@ public function isEnabled(): bool * User defined ACF fields * * @since 0.1.0 - * @return array */ protected function registerFields(): array { @@ -175,7 +160,6 @@ protected function registerFields(): array * Get the block ACF fields * * @since 0.1.0 - * @return array */ public function getFields(): array { @@ -186,7 +170,6 @@ public function getFields(): array * Get the block name * * @since 0.1.0 - * @return string */ public function getName(): string { @@ -197,7 +180,6 @@ public function getName(): string * Get the block title * * @since 0.1.0 - * @return string */ public function getTitle(): string { @@ -208,7 +190,6 @@ public function getTitle(): string * Get the block description * * @since 0.1.0 - * @return string */ public function getDescription(): string { @@ -219,7 +200,6 @@ public function getDescription(): string * Get the block category * * @since 0.1.0 - * @return string */ public function getCategory(): string { @@ -230,7 +210,6 @@ public function getCategory(): string * Get the block icon * * @since 0.1.0 - * @return string */ public function getIcon(): string { @@ -241,7 +220,6 @@ public function getIcon(): string * Get the block keywords * * @since 0.1.0 - * @return array */ public function getKeywords(): array { @@ -252,7 +230,6 @@ public function getKeywords(): array * Get the block post types * * @since 0.1.0 - * @return array */ public function getPostTypes(): array { @@ -263,7 +240,6 @@ public function getPostTypes(): array * Get the block mode * * @since 0.1.0 - * @return string */ public function getMode(): string { @@ -274,7 +250,6 @@ public function getMode(): string * Get the block alignment * * @since 0.1.0 - * @return string */ public function getAlignment(): string { @@ -285,7 +260,6 @@ public function getAlignment(): string * Get featured supported by the block * * @since 0.1.0 - * @return array */ public function getSupports(): array { @@ -296,7 +270,6 @@ public function getSupports(): array * Get the block registration data * * @since 0.1.0 - * @return array */ public function getBlockData(): array { diff --git a/src/Plugin.php b/src/Plugin.php index 06516f4..b8cd9a0 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -11,7 +11,7 @@ final class Plugin * * @var InitializableInterface[] */ - private $initializables = []; + private array $initializables = []; public function add(string ...$initializables): self { @@ -29,7 +29,7 @@ public function getInitializables(): array { return apply_filters( 'acf_gutenblocks/get_initializables', - $this->initializables + $this->initializables, ); }