diff --git a/community-listings/composer.json b/community-listings/composer.json index 8fc6005..582d824 100644 --- a/community-listings/composer.json +++ b/community-listings/composer.json @@ -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" }, @@ -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", diff --git a/community-listings/includes/Service/CptRegistrar.php b/community-listings/includes/Service/CptRegistrar.php index 30e8743..b5cdc8e 100644 --- a/community-listings/includes/Service/CptRegistrar.php +++ b/community-listings/includes/Service/CptRegistrar.php @@ -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', @@ -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; diff --git a/community-listings/includes/Service/GraphQLResolver.php b/community-listings/includes/Service/GraphQLResolver.php index 99ab1a9..d37c18b 100644 --- a/community-listings/includes/Service/GraphQLResolver.php +++ b/community-listings/includes/Service/GraphQLResolver.php @@ -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 $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( diff --git a/community-listings/phpcs.xml b/community-listings/phpcs.xml index 779ddfe..b7fc8d2 100644 --- a/community-listings/phpcs.xml +++ b/community-listings/phpcs.xml @@ -13,10 +13,7 @@ - - - - + diff --git a/community-listings/phpstan.neon b/community-listings/phpstan.neon index 2dadd93..dcf4215 100644 --- a/community-listings/phpstan.neon +++ b/community-listings/phpstan.neon @@ -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 diff --git a/contentful-tables/composer.json b/contentful-tables/composer.json index c86492e..36ff023 100644 --- a/contentful-tables/composer.json +++ b/contentful-tables/composer.json @@ -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" }, @@ -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", diff --git a/contentful-tables/includes/Service/GraphQLResolver.php b/contentful-tables/includes/Service/GraphQLResolver.php index e778613..0c3619f 100644 --- a/contentful-tables/includes/Service/GraphQLResolver.php +++ b/contentful-tables/includes/Service/GraphQLResolver.php @@ -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 $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( diff --git a/contentful-tables/includes/View/ChartRenderer.php b/contentful-tables/includes/View/ChartRenderer.php index 8a8c88a..74d2be8 100644 --- a/contentful-tables/includes/View/ChartRenderer.php +++ b/contentful-tables/includes/View/ChartRenderer.php @@ -82,7 +82,7 @@ private static function render_source( array $chart_data ): string { * @since 4.0.0 * * @param array> $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 { diff --git a/contentful-tables/phpcs.xml b/contentful-tables/phpcs.xml index 039743c..928ed53 100644 --- a/contentful-tables/phpcs.xml +++ b/contentful-tables/phpcs.xml @@ -13,10 +13,7 @@ - - - - + diff --git a/contentful-tables/phpstan.neon b/contentful-tables/phpstan.neon index 8784c4c..f4fb1ad 100644 --- a/contentful-tables/phpstan.neon +++ b/contentful-tables/phpstan.neon @@ -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 diff --git a/graphql-shortcode-support/composer.json b/graphql-shortcode-support/composer.json index a8e4470..8d13397 100644 --- a/graphql-shortcode-support/composer.json +++ b/graphql-shortcode-support/composer.json @@ -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", @@ -51,6 +53,9 @@ "allow-plugins": { "composer/installers": true, "dealerdirect/phpcodesniffer-composer-installer": true + }, + "platform": { + "php": "8.2.0" } } } diff --git a/graphql-shortcode-support/phpcs.xml b/graphql-shortcode-support/phpcs.xml index 748a073..7bc4d36 100644 --- a/graphql-shortcode-support/phpcs.xml +++ b/graphql-shortcode-support/phpcs.xml @@ -19,24 +19,12 @@ - - - - - - - - - - - - - - - - - - + + @@ -47,14 +35,4 @@ - - - - - - - - - - diff --git a/graphql-shortcode-support/phpstan.neon b/graphql-shortcode-support/phpstan.neon index 2721226..7a6e65c 100644 --- a/graphql-shortcode-support/phpstan.neon +++ b/graphql-shortcode-support/phpstan.neon @@ -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: