Skip to content

Commit

Permalink
Adds the PHP linting instructions to the language level README. (#6486)
Browse files Browse the repository at this point in the history
  • Loading branch information
beqqrry-aws committed May 23, 2024
1 parent eb578a0 commit 75fa548
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 16 deletions.
17 changes: 17 additions & 0 deletions php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ To install dependencies, run `composer install` (https://getcomposer.org) before
Many examples come with a `Runner.php` file to abstract the logic of the example from running the code.
From any example directory with a `Runner.php` file, run the example with `php Runner.php`.


## Linting and formatting
We use [phpcs](https://github.com/PHPCSStandards/PHP_CodeSniffer/) to keep this code consistently formatted and styled.
To contribute PHP code to this project, please refer to the following installation and usage steps.

### Using PHPCS

From the `/php` directory, make sure all dependencies are installed at that level with `composer install`.

Then, the linter can be run with
`vendor/bin/phpcs --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor /path/to/lint`

Replace `/path/to/lint` with the directory you wish to check.

Simple errors can be automatically fixed using phpcbf:
`vendor/bin/phpcbf --standard=../.github/linters/phpcs.xml --extensions=php --ignore=vendor example_code/dynamodb/`

## Tests
**Note**: Running the tests might result in charges to your AWS account.

Expand Down
2 changes: 1 addition & 1 deletion php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"php-mock/php-mock-phpunit": "*",
"squizlabs/php_codesniffer": "3.*"
"squizlabs/php_codesniffer": "*"
},
"autoload": {
"psr-0": {
Expand Down
53 changes: 38 additions & 15 deletions php/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75fa548

Please sign in to comment.