Skip to content

Formatting: No way to add spacing on inline closures #922

Description

@joehoyle

Using the "WordPress" style, or manually checking virtually every "add spacing" in the formatter, there doesn't appear a way to add spaces around params in inline closures. I think this should probably inherit / take the value of php.format.rules.spaceWithinDeclParens

    register_rest_field( 'user', 'has_responded_to_personal_data_collection', [ 
		'get_callback' => function (array $item) : ?bool {
			// Only add a token if this is the current user.
			if ( get_current_user_id() !== $item['id'] ) {
				return null;
			}

			return (bool) get_user_meta( $item['id'], 'has_responded_to_personal_data_collection', true );
		},
		'update_callback' => function (bool $value, WP_User $user) : void {
			update_user_meta( $user->ID, 'has_responded_to_personal_data_collection', $value );
		},
		'schema' => [ 
			'description' => 'Whether the user has responded to a request to share personal information for data collection purposes.',
			'type' => 'bool',
		],
	] );

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions