Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion community-listings/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpstan/phpstan": "^2.1",
"silverassist/coding-standards": "^1.0",
"silverassist/wp-coding-standards": "^1.0",
"szepeviktor/phpstan-wordpress": "^2.0",
"wp-coding-standards/wpcs": "^3.1"
},
Expand All @@ -22,7 +24,10 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
"sort-packages": true,
"platform": {
"php": "8.2.0"
}
},
"scripts": {
"phpcs": "phpcs",
Expand Down
38 changes: 21 additions & 17 deletions community-listings/includes/Service/CptRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,28 @@ public static function register_post_type(): void {
);

$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'rest_base' => 'community',
'query_var' => true,
'rewrite' => array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'rest_base' => 'community',
'query_var' => true,
'rewrite' => array(
'slug' => 'communities',
'with_front' => false,
),
'capability_type' => 'post',
'map_meta_cap' => true,
'has_archive' => true,
'hierarchical' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-location-alt',
'capability_type' => 'post',
'map_meta_cap' => true,
'has_archive' => true,
'hierarchical' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-location-alt',
'show_in_graphql' => true,
'graphql_single_name' => 'community',
'graphql_plural_name' => 'communities',
'supports' => array(
'supports' => array(
'title',
'editor',
'excerpt',
Expand Down Expand Up @@ -191,8 +191,12 @@ public function register_graphql_meta_fields(): void {
'resolve' => static function ( $source ) use ( $key, $type ) {
$post_id = 0;

// WPGraphQL Model\Post — preferred.
// WPGraphQL Model\Post — preferred. `databaseId` is WPGraphQL's own
// property name on its Post model; it cannot be renamed to snake_case
// without breaking the property access.
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
if ( \is_object( $source ) && isset( $source->databaseId ) ) {
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$post_id = (int) $source->databaseId;
} elseif ( $source instanceof \WP_Post ) {
$post_id = (int) $source->ID;
Expand Down
16 changes: 8 additions & 8 deletions community-listings/includes/Service/GraphQLResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function register(): void {
*
* @since 2.0.0
*
* @param mixed $result The resolved field value.
* @param mixed $source The source object.
* @param mixed $result The resolved field value.
* @param mixed $source The source object.
* @param array<mixed> $args The field arguments.
* @param mixed $context The AppContext.
* @param mixed $info The ResolveInfo.
* @param string $type_name The GraphQL type name.
* @param string $field_key The field key.
* @param mixed $field_def The field definition.
* @param mixed $field_resolver The field resolver.
* @param mixed $context The AppContext.
* @param mixed $info The ResolveInfo.
* @param string $type_name The GraphQL type name.
* @param string $field_key The field key.
* @param mixed $field_def The field definition.
* @param mixed $field_resolver The field resolver.
* @return mixed The result with shortcodes rendered.
*/
public function resolve_shortcodes(
Expand Down
5 changes: 1 addition & 4 deletions community-listings/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
<config name="minimum_wp_version" value="6.5"/>
<config name="testVersion" value="8.2-"/>

<rule ref="WordPress-Extra">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="SilverAssistWP"/>

<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
Expand Down
3 changes: 2 additions & 1 deletion community-listings/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
includes:
- vendor/silverassist/coding-standards/phpstan/base.neon
- vendor/silverassist/wp-coding-standards/phpstan/base.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon

parameters:
level: 8
paths:
- includes
- community-listings.php
Expand Down
7 changes: 6 additions & 1 deletion contentful-tables/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpstan/phpstan": "^2.1",
"silverassist/coding-standards": "^1.0",
"silverassist/wp-coding-standards": "^1.0",
"szepeviktor/phpstan-wordpress": "^2.0",
"wp-coding-standards/wpcs": "^3.1"
},
Expand All @@ -22,7 +24,10 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
"sort-packages": true,
"platform": {
"php": "8.2.0"
}
},
"scripts": {
"phpcs": "phpcs",
Expand Down
16 changes: 8 additions & 8 deletions contentful-tables/includes/Service/GraphQLResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public function register(): void {
*
* @since 4.0.0
*
* @param mixed $result The resolved field value.
* @param mixed $source The source object.
* @param mixed $result The resolved field value.
* @param mixed $source The source object.
* @param array<mixed> $args The field arguments.
* @param mixed $context The AppContext.
* @param mixed $info The ResolveInfo.
* @param string $type_name The GraphQL type name.
* @param string $field_key The field key.
* @param mixed $field_def The field definition.
* @param mixed $field_resolver The field resolver.
* @param mixed $context The AppContext.
* @param mixed $info The ResolveInfo.
* @param string $type_name The GraphQL type name.
* @param string $field_key The field key.
* @param mixed $field_def The field definition.
* @param mixed $field_resolver The field resolver.
* @return mixed The result with shortcodes rendered.
*/
public function resolve_shortcodes(
Expand Down
2 changes: 1 addition & 1 deletion contentful-tables/includes/View/ChartRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static function render_source( array $chart_data ): string {
* @since 4.0.0
*
* @param array<int, array<int, string>> $table_rows Table data rows.
* @param string $label_prefix Prefix for numeric values.
* @param string $label_prefix Prefix for numeric values.
* @return string Rendered HTML.
*/
private static function render_table_source( array $table_rows, string $label_prefix ): string {
Expand Down
5 changes: 1 addition & 4 deletions contentful-tables/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
<config name="minimum_wp_version" value="6.5"/>
<config name="testVersion" value="8.2-"/>

<rule ref="WordPress-Extra">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="SilverAssistWP"/>

<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
Expand Down
3 changes: 2 additions & 1 deletion contentful-tables/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
includes:
- vendor/silverassist/coding-standards/phpstan/base.neon
- vendor/silverassist/wp-coding-standards/phpstan/base.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon

parameters:
level: 8
paths:
- includes
- contentful-tables.php
Expand Down
5 changes: 5 additions & 0 deletions graphql-shortcode-support/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpstan/phpstan": "*",
"phpunit/phpunit": "^9.6",
"silverassist/coding-standards": "^1.0",
"silverassist/wp-coding-standards": "^1.0",
"squizlabs/php_codesniffer": "^3.7 || ^4.0",
"szepeviktor/phpstan-wordpress": "^1.3 || ^2.0",
"wp-coding-standards/wpcs": "^3.0",
Expand Down Expand Up @@ -51,6 +53,9 @@
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "8.2.0"
}
}
}
34 changes: 6 additions & 28 deletions graphql-shortcode-support/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,12 @@
<!-- Check code for cross-version PHP compatibility -->
<config name="testVersion" value="8.2-"/>

<!-- Include WordPress-Extra standard -->
<rule ref="WordPress-Extra">
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>

<!-- PSR-4 PascalCase filenames, not WordPress hyphenated lowercase -->
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>

<!-- Allow opening braces on same line (K&R style) -->
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
<exclude name="Generic.Classes.OpeningBraceSameLine"/>
</rule>

<!-- Allow short array syntax explicitly -->
<rule ref="Universal.Arrays.DisallowShortArraySyntax">
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/>
</rule>
<!-- Uses the shared SilverAssistWP ruleset from silverassist/wp-coding-standards,
which already covers WordPress-Extra + the short-array-syntax, K&R brace,
and PSR-4 filename allowances, WordPress-Docs, UnusedFunctionParameter,
Generic.Commenting.Todo, and minimum_supported_wp_version 6.5 that used
to be declared individually below. -->
<rule ref="SilverAssistWP"/>

<!-- Enforce WordPress naming conventions -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
Expand All @@ -47,14 +35,4 @@
</property>
</properties>
</rule>

<!-- Enforce WordPress documentation standards -->
<rule ref="WordPress-Docs"/>

<!-- Extra rules -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Commenting.Todo"/>

<!-- Minimum WordPress version -->
<config name="minimum_supported_wp_version" value="6.5"/>
</ruleset>
3 changes: 2 additions & 1 deletion graphql-shortcode-support/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
includes:
- vendor/silverassist/coding-standards/phpstan/base.neon
- vendor/silverassist/wp-coding-standards/phpstan/base.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon

parameters:
level: 8
paths:
- includes
bootstrapFiles:
Expand Down
Loading