Skip to content

Commit

Permalink
Merge pull request #62 from geerteltink/fix/build
Browse files Browse the repository at this point in the history
- build: update composer lock file
- docs: fix markdown formatting
  • Loading branch information
geerteltink committed May 15, 2021
2 parents 9ad639d + d83b58f commit aa75c8c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 25 deletions.
5 changes: 5 additions & 0 deletions docs/book/v1/intro.md
Expand Up @@ -3,11 +3,13 @@
## Installation

1. Install the module via Composer by running:

```bash
$ composer require --dev laminas/laminas-coding-standard
```

2. Add Composer scripts into your `composer.json`:

```json
"scripts": {
"cs-check": "phpcs",
Expand All @@ -16,6 +18,7 @@
```

3. Create file `phpcs.xml` on base path of your repository with content:

```xml
<?xml version="1.0"?>
<ruleset name="Laminas Coding Standard">
Expand All @@ -34,11 +37,13 @@ For a reference please see: https://github.com/squizlabs/PHP_CodeSniffer/wiki/An
## Usage

* To run checks only:

```bash
$ composer cs-check
```

* To automatically fix many CS issues:

```bash
$ composer cs-fix
```
15 changes: 10 additions & 5 deletions docs/book/v1/ruleset.md
@@ -1,16 +1,21 @@
# Ruleset

## Use PSR-2 coding standard as a base
*PSR2*

Rule: *PSR2*

## Disallow long array syntax
*Generic.Arrays.DisallowLongArraySyntax*

Rule: *Generic.Arrays.DisallowLongArraySyntax*

## Force whitespace after `!`
*Generic.Formatting.SpaceAfterNot*

Rule: *Generic.Formatting.SpaceAfterNot*

## Forbid spaces before semicolon `;`
*Squiz.WhiteSpace.SemicolonSpacing*

Rule: *Squiz.WhiteSpace.SemicolonSpacing*

## Forbid superfluous whitespaces
*Squiz.WhiteSpace.SuperfluousWhitespace, Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines*

Rule: *Squiz.WhiteSpace.SuperfluousWhitespace, Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines*
17 changes: 9 additions & 8 deletions docs/book/v2/coding-style-guide.md
Expand Up @@ -251,14 +251,14 @@ each of the blocks below MUST be separated by a single blank line, and MUST NOT
a blank line. Each block MUST be in the order listed below, although blocks that are
not relevant may be omitted.

* Opening `<?php` tag.
* File-level docblock.
* One or more declare statements.
* The namespace declaration of the file.
* One or more class-based `use` import statements.
* One or more function-based `use` import statements.
* One or more constant-based `use` import statements.
* The remainder of the code in the file.
- Opening `<?php` tag.
- File-level docblock.
- One or more declare statements.
- The namespace declaration of the file.
- One or more class-based `use` import statements.
- One or more function-based `use` import statements.
- One or more constant-based `use` import statements.
- The remainder of the code in the file.

When a file contains a mix of HTML and PHP, any of the above sections may still
be used. If so, they MUST be present at the top of the file, even if the
Expand Down Expand Up @@ -1099,6 +1099,7 @@ $variable = $foo ? 'foo' : 'bar';

When the middle operand of the conditional operator is omitted, the operator
MUST follow the same style rules as other binary [comparison][] operators:

```php
$variable = $foo ?: 'bar';
```
Expand Down
29 changes: 17 additions & 12 deletions docs/book/v2/intro.md
@@ -1,7 +1,7 @@
# Introduction

**This specification extends and expands [PSR-12](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md),
the extended coding style guide and requires adherence to [PSR-1](https://www.php-fig.org/psr/psr-1),
**This specification extends and expands [PSR-12](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md),
the extended coding style guide and requires adherence to [PSR-1](https://www.php-fig.org/psr/psr-1),
the basic coding standard.**

These are minimal specifications and don't address all factors, including things like:
Expand All @@ -13,18 +13,20 @@ These are minimal specifications and don't address all factors, including things
- what and what not to import, and how
- etc.

Contributors have different coding styles and so do the maintainers. During code reviews there are regularly
discussions about spaces and alignments, where and when was said that a function needs to be imported. And
Contributors have different coding styles and so do the maintainers. During code reviews there are regularly
discussions about spaces and alignments, where and when was said that a function needs to be imported. And
that's where this coding standard comes in: To have internal consistency in a component and between components.

## Installation

1. Install the module via Composer by running:

```bash
$ composer require --dev laminas/laminas-coding-standard
```

2. Add Composer scripts into your `composer.json`:

```json
"scripts": {
"cs-check": "phpcs",
Expand All @@ -33,25 +35,26 @@ that's where this coding standard comes in: To have internal consistency in a co
```

3. Create file `phpcs.xml` on base path of your repository with this content:

```xml
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>

<!-- Show progress -->
<arg value="p"/>

<!-- Paths to check -->
<file>config</file>
<file>src</file>
<file>test</file>

<!-- Include all rules from the Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>
</ruleset>
Expand All @@ -62,12 +65,14 @@ the ["Annotated Ruleset" of PHP_CodeSniffer](https://github.com/squizlabs/PHP_Co

## Usage

* To run checks only:
- To run checks only:

```bash
$ composer cs-check
```

* To automatically fix many CS issues:
- To automatically fix many CS issues:

```bash
$ composer cs-fix
```
Expand Down Expand Up @@ -109,7 +114,7 @@ $xmlPackage->send();
> should always be based on the develop branch and queued for the next major
> release, unless considered a bugfix for existing rules.
If you want to test changes against Laminas components or your own projects, install your forked
If you want to test changes against Laminas components or your own projects, install your forked
laminas-coding-standard globally with Composer:

```bash
Expand All @@ -124,7 +129,7 @@ $ phpcs -sp --standard=LaminasCodingStandard src test
**Make sure you remove the global installation after testing from your global
`composer.json` file!**

Documentation can be previewed locally by installing [MkDocs](https://www.mkdocs.org/#installation) and run
Documentation can be previewed locally by installing [MkDocs](https://www.mkdocs.org/#installation) and run
`mkdocs serve`. This will start a server where you can read the docs.

## Reference
Expand Down

0 comments on commit aa75c8c

Please sign in to comment.