Skip to content

Commit

Permalink
Fix heading levels in readme (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanDelMar authored Nov 11, 2024
1 parent e6e3e89 commit b2c0044
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Static analysis for the WordPress ecosystem.
- [PHPStan](https://phpstan.org/)
- [WordPress](https://wordpress.org/)

### Installation
## Installation

Add this package to your project.

Expand All @@ -41,7 +41,7 @@ includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
```

### Configuration
## Configuration

Needs no extra configuration. :smiley: Simply configure PHPStan - for example - this way.

Expand All @@ -58,19 +58,19 @@ Please read [PHPStan Config Reference](https://phpstan.org/config-reference).
:bulb: Use Composer autoloader or a
[custom autoloader](https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/wp-install/wordpress-autoloader.php)!

### Usage
## Usage

Just start the analysis: `vendor/bin/phpstan analyze`
then fix an error and `GOTO 10`!

You find further information in the `examples` directory
e.g. [`examples/phpstan.neon.dist`](/examples/phpstan.neon.dist)

### Usage in WooCommerce webshops
## Usage in WooCommerce webshops

Please see [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs)

### What this extension does
## What this extension does

- Makes it possible to run PHPStan on WordPress plugins and themes
- Loads [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs) package
Expand All @@ -79,7 +79,7 @@ Please see [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs)
- Defines some core constants
- Validates the optional docblock that precedes a call to `apply_filters()` and treats the type of its first `@param` as certain

### Usage of an `apply_filters()` docblock
## Usage of an `apply_filters()` docblock

WordPress core - and the wider WordPress ecosystem - uses PHPDoc docblocks
in a non-standard manner to document the parameters passed to `apply_filters()`.
Expand All @@ -102,7 +102,7 @@ according to the first `@param` tag. In the example above this means PHPStan tre
To make the best use of this feature,
ensure that the type of the first `@param` tag in each of these such docblocks is accurate and correct.

### Make your code testable
## Make your code testable

- Write clean OOP code: 1 class per file, no other code in class files outside `class Name { ... }`
- Structure your code: uniform class names (WPCS or PSR-4), keep classes in a separate directory `inc/`
Expand All @@ -118,7 +118,7 @@ ensure that the type of the first `@param` tag in each of these such docblocks i
[Neutron Standard](https://github.com/Automattic/phpcs-neutron-standard)
- Do not enable `exit_error` in `WP_CLI::launch` or `WP_CLI::runcommand` to keep your code testable

### Dirty corner (FAQ)
## Dirty corner (FAQ)

WordPress uses conditional function and class definition for override purposes.
Use `sed` command to exclude function stubs when they are previously defined.
Expand Down

0 comments on commit b2c0044

Please sign in to comment.