Skip to content

Commit

Permalink
feat!: release 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nlemoine committed Feb 23, 2024
1 parent 656c458 commit 7154518
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 42 deletions.
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"php": "^7.4 || ^8.0"
},
"require-dev": {
"advanced-custom-fields/advanced-custom-fields-pro": "^5.9 || ^6.0",
"wpengine/advanced-custom-fields-pro": "^6.0",
"stoutlogic/acf-builder": "^1.12",
"symplify/easy-coding-standard": "^11.1",
"symplify/easy-coding-standard": "^12.1",
"umpirsky/country-list": "*"
},
"repositories": [
Expand All @@ -34,7 +34,10 @@
},
{
"type": "composer",
"url": "https://pivvenit.github.io/acf-composer-bridge/composer/v3/wordpress-plugin/"
"url": "https://connect.advancedcustomfields.com",
"only": [
"wpengine/*"
]
}
],
"minimum-stability": "dev",
Expand Down Expand Up @@ -67,12 +70,8 @@
"post-update-cmd": [
"@sync-country-data"
],
"lint": [
"ecs check"
],
"lint:fix": [
"ecs check --fix"
],
"cs": "ecs check",
"cs:fix": "ecs check --fix",
"sync-country-data": [
"rsync -zavr --include '*/' --include '*.php' --exclude '*' --prune-empty-dirs vendor/umpirsky/country-list/data ."
]
Expand Down
87 changes: 58 additions & 29 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,66 @@
<?php

use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
declare(strict_types=1);

use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer;
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
use PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDefaultCommentFixer;
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->parallel();

$ecsConfig->paths([__DIR__ . '/src', __DIR__ . '/plugin.php']);

$ecsConfig->sets([SetList::COMMON, SetList::PSR_12, SetList::CLEAN_CODE]);

$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
'syntax' => 'short',
]);
$ecsConfig->ruleWithConfiguration(NativeFunctionInvocationFixer::class, [
return ECSConfig::configure()
->withParallel()
->withPaths([
__DIR__ . '/ecs.php',
__DIR__ . '/acf-country.php',
__DIR__ . '/src',
])
/**
* Import
* @see https://cs.symfony.com/doc/rules/index.html#import
*/
->withRules([
FullyQualifiedStrictTypesFixer::class,
NoLeadingImportSlashFixer::class,
SingleImportPerStatementFixer::class,
])
->withConfiguredRule(GlobalNamespaceImportFixer::class, [
'import_classes' => true,
])
->withConfiguredRule(BinaryOperatorSpacesFixer::class, [
'operators' => [
'=>' => 'align_single_space',
],
])
/**
* NativeFunctionInvocation
* @see https://cs.symfony.com/doc/rules/function_notation/native_function_invocation.html
*/
->withConfiguredRule(NativeFunctionInvocationFixer::class, [
'include' => [
'@all',
],
'scope' => 'namespaced'
]);
$ecsConfig->ruleWithConfiguration(BinaryOperatorSpacesFixer::class, [
'operators' => ['=>' => 'align_single_space'],
]);

$ecsConfig->skip([
DeclareStrictTypesFixer::class => null,
NotOperatorWithSuccessorSpaceFixer::class => null,
RemoveUselessDefaultCommentFixer::class => null,
]);
};
'scope' => 'namespaced',
'strict' => true,
])
->withSets([
SetList::PSR_12,
SetList::ARRAY,
SetList::SPACES,
SetList::NAMESPACES,
SetList::DOCBLOCK,
SetList::COMMENTS,
SetList::STRICT,
])
->withSkip([
DeclareStrictTypesFixer::class,
NotOperatorWithSuccessorSpaceFixer::class,
RemoveUselessDefaultCommentFixer::class,
MethodChainingIndentationFixer::class,
])
;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"env:start": "wp-env start"
},
"devDependencies": {
"@wordpress/env": "^5.7.0",
"@wordpress/scripts": "^24.6.0",
"@wordpress/env": "^9.4.0",
"@wordpress/scripts": "^27.3.0",
"assets-webpack-plugin": "^7.1.1",
"mini-css-extract-plugin": "^2.7.0",
"mini-css-extract-plugin": "^2.8.0",
"webpack-manifest-plugin": "^5.0.0"
}
}
11 changes: 10 additions & 1 deletion src/CountryField.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace HelloNico\AcfCountry;

use acf_field;

class CountryField extends \acf_field
class CountryField extends acf_field
{
public const FORMAT_VALUE = 'value';

Expand All @@ -27,6 +29,13 @@ class CountryField extends \acf_field

protected acf_field $select;

/**
* Isn't needed because we're extending acf_field, but it's here for clarity.
*
* @var boolean
*/
public bool $show_in_rest = true;

/**
* Create a new field instance.
*/
Expand Down

0 comments on commit 7154518

Please sign in to comment.