pressbooks/coding-standards

Installs: 18 664

Dependents: 14

Suggesters: 0

Security: 0

Stars: 2

Watchers: 9

Forks: 2

Open Issues: 5

Type:project

1.1.0 2021-08-09 16:26 UTC

This package is auto-updated.

Last update: 2024-03-01 00:12:43 UTC


README

These are our coding standards. There are many like these, but these are ours.

Our standards are basically Human Made's coding standards with a few tweaks:

  • Use camelCase for class methods & properties, UPPERCASE for class constants, snake_case everywhere else.
  • PHP Sessions are allowed.
  • A few more...

Tips

Pressbooks classes that extend WP Core classes will fail the PSR1.Methods.CamelCapsMethodName rule. In those cases, add something like this in your phpcs.ruleset.xml file:

<rule ref="PSR1.Methods.CamelCapsMethodName" >   
    <exclude-pattern>/inc/admin/class-catalog-list-table.php</exclude-pattern>
    <exclude-pattern>/inc/admin/class-network-managers-list-table.php</exclude-pattern>
    <exclude-pattern>/api/endpoints/controller/*</exclude-pattern>
</rule>

Link to docs: https://docs.pressbooks.org/coding-standards/