Skip to content

Commit e0e7b33

Browse files
committed
Minor grammar fixes
Grammarly caught some missing articles, some misspellings, etc.
1 parent 38e2c0c commit e0e7b33

File tree

1 file changed

+9
-9
lines changed
  • wordpress-coding-standards

1 file changed

+9
-9
lines changed

wordpress-coding-standards/php.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Note that requiring the use of braces just means that _single-statement inline c
133133

134134
Using long array syntax ( `array( 1, 2, 3 )` ) for declaring arrays is generally more readable than short array syntax ( `[ 1, 2, 3 ]` ), particularly for those with vision difficulties. Additionally, it's much more descriptive for beginners.
135135

136-
Arrays must be declared using long array syntax.
136+
Arrays must be declared using the long array syntax.
137137

138138
### Closures (Anonymous Functions)
139139

@@ -237,11 +237,11 @@ Incorrect:
237237

238238
### Remove Trailing Spaces
239239

240-
Remove trailing whitespace at the end of each line of code. Omitting the closing PHP tag at the end of a file is preferred. If you use the tag, make sure you remove trailing whitespace.
240+
Remove trailing whitespace at the end of each line of code. Omitting the closing PHP tag at the end of a file is preferred. If you use the tag, make sure you remove the trailing whitespace.
241241

242242
### Space Usage
243243

244-
Always put spaces after commas, and on both sides of logical, comparison, string and assignment operators.
244+
Always put spaces after commas, and on both sides of the logical, comparison, string, and assignment operators.
245245

246246
```php
247247
x === 23
@@ -327,7 +327,7 @@ my_function( ( $x - 1 ) * 5, $y );
327327

328328
### Formatting SQL statements
329329

330-
When formatting SQL statements you may break it into several lines and indent if it is sufficiently complex to warrant it. Most statements work well as one line though. Always capitalize the SQL parts of the statement like `UPDATE` or `WHERE`.
330+
When formatting SQL statements you may break them into several lines and indent if it is sufficiently complex to warrant it. Most statements work well as one line though. Always capitalize the SQL parts of the statement like `UPDATE` or `WHERE`.
331331

332332
Functions that update the database should expect their parameters to lack SQL slash escaping when passed. Escaping should be done as close to the time of the query as possible, preferably by using `$wpdb->prepare()`
333333

@@ -340,7 +340,7 @@ $id = some_foo_number(); // data we expect to be an integer, but we're not certa
340340
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_title = %s WHERE ID = %d", $var, $id ) );
341341
```
342342

343-
`%s` is used for string placeholders and `%d` is used for integer placeholders. Note that they are not 'quoted'! `$wpdb->prepare()` will take care of escaping and quoting for us. The benefit of this is that we don't have to remember to manually use [`esc_sql()`](https://developer.wordpress.org/reference/functions/esc_sql/), and also that it is easy to see at a glance whether something has been escaped or not, because it happens right when the query happens.
343+
`%s` is used for string placeholders and `%d` is used for integer placeholders. Note that they are not 'quoted'! `$wpdb->prepare()` will take care of escaping and quoting for us. The benefit of this is that we don't have to remember to manually use [`esc_sql()`](https://developer.wordpress.org/reference/functions/esc_sql/), and also that it is easy to see at a glance whether something has been escaped or not because it happens right when the query happens.
344344

345345
See [Data Validation](https://developer.wordpress.org/plugins/security/data-validation/) in the Plugin Handbook for further details.
346346

@@ -377,7 +377,7 @@ Files should be named descriptively using lowercase letters. Hyphens should sepa
377377
my-plugin-name.php
378378
```
379379

380-
Class file names should be based on the class name with `class-` prepended and the underscores in the class name replaced with hyphens, for example `WP_Error` becomes:
380+
Class file names should be based on the class name with `class-` prepended and the underscores in the class name replaced with hyphens, for example, `WP_Error` becomes:
381381

382382
```php
383383
class-wp-error.php
@@ -456,7 +456,7 @@ Dynamic hooks should be named using interpolation rather than concatenation for
456456

457457
Dynamic hooks are hooks that include dynamic values in their tag name, e.g. `{$new_status}_{$post->post_type}` (publish_post).
458458

459-
Variables used in hook tags should be wrapped in curly braces `{` and `}`, with the complete outer tag name wrapped in double quotes. This is to ensure PHP can correctly parse the given variables' types within the interpolated string.
459+
Variables used in hook tags should be wrapped in curly braces `{` and `}`, with the complete outer tag name wrapped in double-quotes. This is to ensure PHP can correctly parse the given variables' types within the interpolated string.
460460

461461
```php
462462
do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
@@ -568,7 +568,7 @@ switch ( $foo ) {
568568

569569
The `goto` statement must never be used.
570570

571-
The `eval()` construct is _very dangerous_, and is impossible to secure. Additionally, the `create_function()` function, which internally performs an `eval()`, is deprecated in PHP 7.2. Neither of these must be used.
571+
The `eval()` construct is _very dangerous_ and is impossible to secure. Additionally, the `create_function()` function, which internally performs an `eval()`, is deprecated in PHP 7.2. Neither of these must be used.
572572

573573
### Error Control Operator `@`
574574

@@ -584,6 +584,6 @@ While this operator does exist in Core, it is often used lazily instead of doing
584584

585585
Per [#22400](https://core.trac.wordpress.org/ticket/22400 "Remove all, or at least most, uses of extract() within WordPress"):
586586

587-
> `extract()` is a terrible function that makes code harder to debug and harder to understand. We should discourage it's [sic] use and remove all of our uses of it.
587+
> `extract()` is a terrible function that makes code harder to debug and harder to understand. We should discourage its (sic) use and remove all of our uses of it.
588588
589589
Joseph Scott has [a good write-up of why it's bad](https://blog.josephscott.org/2009/02/05/i-dont-like-phps-extract-function/).

0 commit comments

Comments
 (0)