Code Monkey home page Code Monkey logo

laminas-coding-standard's Introduction

laminas-coding-standard

Build Status

🇷🇺 Русским гражданам

Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.

У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.

Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"

🇺🇸 To Citizens of Russia

We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.

One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.

You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"

The coding standard ruleset for Laminas components.

This specification extends and expands PSR-12, the extended coding style guide and requires adherence to PSR-1, the basic coding standard. These are minimal specifications and don't address all factors, including things like:

  • whitespace around operators
  • alignment of array keys and operators
  • alignment of object operations
  • how to format multi-line conditionals
  • 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 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:

    composer require --dev laminas/laminas-coding-standard
  2. Add composer scripts into your composer.json:

    "scripts": {
      "cs-check": "phpcs",
      "cs-fix": "phpcbf"
    }
  3. Create file phpcs.xml on base path of your repository with this content:

    <?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>

You can add or exclude some locations in that file. For a reference please see: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset

Usage

  • To run checks only:

    composer cs-check
  • To automatically fix many CS issues:

    composer cs-fix

Ignoring parts of a File

Note: Before PHP_CodeSniffer version 3.2.0, // @codingStandardsIgnoreStart and // @codingStandardsIgnoreEnd were used. These are deprecated and will be removed in PHP_CodeSniffer version 4.0.

Disable parts of a file:

$xmlPackage = new XMLPackage;
// phpcs:disable
$xmlPackage['error_code'] = get_default_error_code_value();
$xmlPackage->send();
// phpcs:enable

Disable a specific rule:

// phpcs:disable Generic.Commenting.Todo.Found
$xmlPackage = new XMLPackage;
$xmlPackage['error_code'] = get_default_error_code_value();
// TODO: Add an error message here.
$xmlPackage->send();
// phpcs:enable

Ignore a specific violation:

$xmlPackage = new XMLPackage;
$xmlPackage['error_code'] = get_default_error_code_value();
// phpcs:ignore Generic.Commenting.Todo.Found
// TODO: Add an error message here.
$xmlPackage->send();

Development

New rules or Sniffs may not be introduced in minor or bugfix releases and 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 laminas-coding-standard globally with composer:

$ composer global config repositories.laminas-coding-standard vcs [email protected]:<FORK_NAMESPACE>/laminas-coding-standard.git
$ composer global require --dev laminas/laminas-coding-standard:dev-<FORKED_BRANCH>

# For this to work, add this to your path: ~/.composer/vendor/bin
# Using `-s` prints the rules that triggered the errors so they can be reviewed easily. `-p` is for progress display.
$ 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 and run mkdocs serve. This will start a server where you can read the docs.

Reference

Rules can be added, excluded or tweaked locally, depending on your preferences. More information on how to do this can be found here:

laminas-coding-standard's People

Contributors

autowp avatar boesing avatar danack avatar froschdesign avatar geerteltink avatar ghostwriter avatar gsteel avatar gszy avatar jrfnl avatar laminas-bot avatar lcobucci avatar michalbundyra avatar ocramius avatar renovate[bot] avatar samsonasik avatar sommer-gei avatar weierophinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laminas-coding-standard's Issues

[v2] Intersection types not recognized in docblocks

2.0.0-alpha.3 standard does not recognize and improperly reformats intersect types(&) in phpdoc:

     /**
      * Inject a service into the container mock.
      *
      * Adjust `has('service')` and `get('service')` returns.
      *
-     * @param ContainerInterface&ObjectProphecy $container
+     * @param ContainerInterface &ObjectProphecy $container
      * @param mixed              $service
      */
     protected function injectServiceInContainer(ObjectProphecy $container, string $serviceName, $service) : void
     {
         $container->has($serviceName)->willReturn(true);
         $container->get($serviceName)->willReturn($service);
     }

Intersections types are supported by PhpStorm, phpstan and present in the draft for phpdoc PSR
https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#details


Originally posted by @Xerkus at zendframework/zend-coding-standard#16

[v2] Must not replace Exception with Throwable

\Exception and \Throwable are not equal and must not be swapped.
\Throwable includes php errors, some of which are not really recoverable.

On top of that it actually breaks code in some instances:

         $exception = $this->prophesize(NotFoundExceptionInterface::class)
-            ->willExtend(Exception::class)
+            ->willExtend(Throwable::class)
             ->reveal();

Originally posted by @Xerkus at zendframework/zend-coding-standard#17

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ^7.4 || ^8.0
  • dealerdirect/phpcodesniffer-composer-installer ^0.7 || ^1.0
  • slevomat/coding-standard ^7.0
  • squizlabs/php_codesniffer ^3.6
  • webimpress/coding-standard ^1.2
github-actions
.github/workflows/continuous-integration.yml
.github/workflows/docs-build.yml
.github/workflows/release-on-milestone-closed.yml

  • Check this box to trigger a request for Renovate to run again on this repository

docblock is not recognized as belonging to closure when closure is immediately returned

Bug Report

Q A
Version(s) 2.1.4

Summary

Coding standard does not recognize docblock as belonging to a closure when closure is immediately returned.
Bug is likely in PSR12.Files.FileHeader.IncorrectOrder

Current behavior

While applying Laminas CS to newly installed mezzio skeleton application I discovered that pipeline.php and routes.php trigger
errors PSR12.Files.FileHeader.IncorrectOrder: Header blocks must be separated by a single blank line and PSR12.Files.FileHeader.IncorrectOrder: The file-level docblock must follow the opening PHP tag in the file header

How to reproduce

Run CS check against mezzio skeleton config file https://github.com/mezzio/mezzio-skeleton/blob/c268aac1a272ee20b9bceaa5715aac4174d388ae/src/MezzioInstaller/Resources/config/routes-fastroute-minimal.php#L9-L26

<?php

declare(strict_types=1);

use Mezzio\Application;
use Mezzio\MiddlewareFactory;
use Psr\Container\ContainerInterface;

/**
 * FastRoute route configuration
 *
 * @see https://github.com/nikic/FastRoute
 *
 * Setup routes with a single request method:
 *
 * $app->get('/', App\Handler\HomePageHandler::class, 'home');
 * $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
 * $app->put('/album/{id:\d+}', App\Handler\AlbumUpdateHandler::class, 'album.put');
 * $app->patch('/album/{id:\d+}', App\Handler\AlbumUpdateHandler::class, 'album.patch');
 * $app->delete('/album/{id:\d+}', App\Handler\AlbumDeleteHandler::class, 'album.delete');
 *
 * Or with multiple request methods:
 *
 * $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
 */
return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void {
};

Expected behavior

This docblock should be accepted as closure level rather than file level

License header checks

Adds license header sniff and MD files sniff

  • check all files for license header
  • check contents of MD files if match with templates from maintainers repository
  • sniff to check if COPYTIGHT.md and LICENSE.md files exists in the repo, and create them (it's a bit hacky, because sniffs works only on existing files, so we run this sniff only ONCE on first found token)

Replaces #2
Please have a look on commits dc3d49b and e7528fe

/cc @xtreamwayz @weierophinney


Originally posted by @michalbundyra at zendframework/zend-coding-standard#4

Broken equality comparisons

v2.0.0rc1

phpcbf breaks equality comparasions.

Reproducing.

Source code:

<?php

var_dump(1 == '1');

Test:

$php test.php 
bool(true)

Code cleaning:

./vendor/bin/phpcbf test.php
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE                                                  FIXED  REMAINING
----------------------------------------------------------------------
/home/dvp/eclipse-workspace/autowp/test.php           1      1
----------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
----------------------------------------------------------------------

Clean source code:

<?php

var_dump(1 === '1');

Test again

$php test.php 
bool(false)

Expected: bool(true)

Clarify documentation about optional param and return tags in docblock

Currently documentation mentions phpDoc tags @param and @return as being optional and in some cases undesirable. However it is done briefly and in a way that is easy to gloss over unless you already know what you are looking for.

https://github.com/laminas/laminas-coding-standard/blob/3c4bc41512e8e8577765c18ab66e6b9a3467ed20/docs/book/v2/coding-style-guide.md#9-commenting-and-docblocks

Code SHOULD be written so it explains itself. DocBlocks and comments SHOULD only be used if necessary. They MUST NOT start with # and MUST NOT be empty. They SHOULD NOT be used for already typehinted arguments, except arrays.

I believe it is fairly significant rule and should be elevated to its own block that also includes code example.

Psalm integration

Feature Request

Q A
QA yes

Summary

As decided during the Technical-Steering-Committee Meeting on August 3rd, 2020, Laminas wants to implement vimeo/psalm in all packages.

Implementing psalm is quite easy.

Required

  • Create a .psalm.xml.dist in the project root
  • Copy and paste the contents from this psalm.xml.dist
  • Run $ composer require vimeo/psalm
  • Run $ vendor/bin/psalm --set-baseline=psalm-baseline.xml
  • Add a composer script static-analysis with the command psalm --shepherd --stats
  • Add a new line to script: in .travis.yml: - if [[ $TEST_COVERAGE == 'true' ]]; then composer static-analysis ; fi
  • Remove phpstan from the project (phpstan.neon.dist, .travis.yml entry, composer.json require-dev and scripts)
Optional
  • Fix as many psalm errors as possible.

Conflicting indent rules

  • I was not able to find an open or closed issue matching what I'm seeing.
  • This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

It seems there are two conflicting indent rules.

Code to reproduce the issue

Variant 1

    $routes->connect('/test/:test', 'Test::test', [
        '_name'   => 'test',
        '_method' => ['GET', 'POST'],
    ])
        ->setPass(['test']);

Shows an error for line 2-4: Invalid indent. Expected 12 spaces, found 8.
phpcbf corrects this to variant 2.

Variant 2

    $routes->connect('/test/:test', 'Test::test', [
            '_name'   => 'test',
            '_method' => ['GET', 'POST'],
        ])
        ->setPass(['test']);

Shows an error for line 2-4: Array key not indented correctly; expected 8 spaces but found 12.
phpcbf corrects this to variant 1.

Variants that show no errors

    $routes->connect(
            '/test/:test',
            'Test::test',
            [
                '_name'   => 'test',
                '_method' => ['GET', 'POST'],
            ]
        )
        ->setPass(['test']);
    $routes
        ->connect(
            '/test/:test',
            'Test::test',
            [
                '_name'   => 'test',
                '_method' => ['GET', 'POST'],
            ]
        )
        ->setPass(['test']);
    $routes
        ->connect('/test/:test', 'Test::test', [
            '_name'   => 'test',
            '_method' => ['GET', 'POST'],
        ])
        ->setPass(['test']);

Expected results

One of the variants should show no error, or phpcbf should correct both variants to a variant that shows no error.

Actual results

Both variants show an error, and phpcbf corrects them in a loop.


Originally posted by @PatrickG at zendframework/zend-coding-standard#20

phpcbf breaks interface matching

Bug Report

Q A
Version(s) 2.1.0

Summary

phpcbf breaks interface matching.
All Laminas\ServiceManager\Factory\FactoryInterface implementations is broken after autofix because of $requestedName parameter typed with phpdoc

Current behavior

<?php

namespace Test;

class Test implements ITest
{
    /**
     * @param string $string
     */
    public function doIt($string): void
    {
        print $string;
    }
}

converted to

<?php

namespace Test;

class Test implements ITest
{
    public function doIt(string $string): void
    {
        print $string;
    }
}

regadless of interface method definition: Declaration must be compatible with ITest->doIt(string: string)

Expected behavior

Don't convert phpdoc type hints automatically

Workaround

Exclude SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint

Contradicting rules for file header comment

Bug Report

Q A
Versions 2.0.x

Summary

Rules WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment and PSR12.Files.FileHeader.IncorrectOrder contradict themselves, if the file header comment does not include both a @copyright and @license tag.

In this report the development.config.php.dist of the Mezzio Skeleton will serve as example.

Current behavior

Running phpcbf on the example file, will fix the violation of WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment and open the violation of PSR12.Files.FileHeader.IncorrectOrder at the same time.

How to reproduce

Detailed instructions are provided in arueckauer/strict-type-declaration-cs-issue. In summary run the following commands on development.config.php.dist.

  1. phpcs: Fixable violation of WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment (the other violation is irrelevant for this issue).
  2. phpcbf: Fixed: 2; Remaining: 1.
  3. phpcs: Violation of PSR12.Files.FileHeader.IncorrectOrder

Expected behavior

Here I am not sure. Probably the file header comment should be always above the strict type declaration. But it is not clear to me...

[v2] Strict types declaration placed before copyright block

With copyright docblock using older @link tag format, strict types declaration is placed before it.

 <?php
+
+declare(strict_types=1);
+
 /**
  * @link      http://github.com/zendframework/zend-mvc for the canonical source repository
  * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   https://github.com/zendframework/zend-mvc/blob/master/LICENSE.md New BSD License
  */

But with @see it is placed after the docblock as it should be:

 <?php
+
 /**
- * @link      http://github.com/zendframework/zend-mvc for the canonical source repository
+ * @see      http://github.com/zendframework/zend-mvc for the canonical source repository
  * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   https://github.com/zendframework/zend-mvc/blob/master/LICENSE.md New BSD License
  */
 
+declare(strict_types=1);
+

On a side note, should that extra empty line be added before copyright? Looks like unintended side effect of strict types sniff


Originally posted by @Xerkus at zendframework/zend-coding-standard#15

Generic.Arrays.ArrayIndent & Generic.WhiteSpace.ScopeIndent conflict

Bug Report

Q A
Version(s) 2.0.0rc1

Summary

phpcbf loops until attempts limit (50) with rules Generic.Arrays.ArrayIndent & Generic.WhiteSpace.ScopeIndent then failed to fix.
On big sources failed on time limit (10min)

Current behavior

$./vendor/bin/phpcbf test.php
----------------------------------------------------------------------
FILE                                                  FIXED  REMAINING
----------------------------------------------------------------------
test.php                                              FAILED TO FIX
----------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
----------------------------------------------------------------------
PHPCBF FAILED TO FIX 1 FILE
----------------------------------------------------------------------

How to reproduce

Minimal source to reproduce:

<?php

function test()
{
    query('
        INSERT INTO table (column)
        VALUES (:value)
    ', [
        'value' => $value,
    ]);
}

Expected behavior

No error (all other rules applied)

Verbose output fragment

$./vendor/bin/phpcbf test.php -vvvv

---START FILE CONTENT---
 1|<?php
 2|
 3|function test()
 4|{
 5|    query('
 6|        INSERT INTO table (column)
 7|        VALUES (:value)
 8|    ', [
 9|    'value' => $value,
10|    ]);
11|}
12|
--- END FILE CONTENT ---
	**** Generic.Arrays.ArrayIndent:137 has possible conflict with another sniff on loop 45; caused by the following change ****
	**** replaced token 29 (T_WHITESPACE on line 10) "····]" => "]" ****
	**** ignoring all changes until next loop ****
        => Fixing file: 0/2 violations remaining [made 47 passes]...    * fixed 0 violations, starting loop 48 *
---START FILE CONTENT---
 1|<?php
 2|
 3|function test()
 4|{
 5|    query('
 6|        INSERT INTO table (column)
 7|        VALUES (:value)
 8|    ', [
 9|    'value' => $value,
10|    ]);
11|}
12|
--- END FILE CONTENT ---
	Generic.Arrays.ArrayIndent:137 replaced token 29 (T_WHITESPACE on line 10) "····]" => "]"
        => Fixing file: 1/2 violations remaining [made 48 passes]...    * fixed 1 violations, starting loop 49 *
---START FILE CONTENT---
 1|<?php
 2|
 3|function test()
 4|{
 5|    query('
 6|        INSERT INTO table (column)
 7|        VALUES (:value)
 8|    ', [
 9|    'value' => $value,
10|]);
11|}
12|
--- END FILE CONTENT ---
	**** Generic.WhiteSpace.ScopeIndent:1476 has possible conflict with another sniff on loop 47; caused by the following change ****
	**** replaced token 29 (T_CLOSE_SHORT_ARRAY on line 10) "]" => "····]" ****
	**** ignoring all changes until next loop ****
        => Fixing file: 0/2 violations remaining [made 49 passes]...    * fixed 0 violations, starting loop 50 *
---START FILE CONTENT---
 1|<?php
 2|
 3|function test()
 4|{
 5|    query('
 6|        INSERT INTO table (column)
 7|        VALUES (:value)
 8|    ', [
 9|    'value' => $value,
10|]);
11|}
12|
--- END FILE CONTENT ---
	Generic.WhiteSpace.ScopeIndent:1476 replaced token 29 (T_CLOSE_SHORT_ARRAY on line 10) "]" => "····]"
        => Fixing file: 1/2 violations remaining [made 50 passes]...    * fixed 1 violations, starting loop 51 *
	*** Reached maximum number of loops with 1 violations left unfixed ***
ERROR in 217ms

PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE                                                  FIXED  REMAINING
----------------------------------------------------------------------
test.php                                              FAILED TO FIX
----------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
----------------------------------------------------------------------
PHPCBF FAILED TO FIX 1 FILE
----------------------------------------------------------------------

Time: 292ms; Memory: 10MB

Double quote usage

Squiz.Strings.DoubleQuoteUsage.ContainsVar prevents strings containing variables. This doesn't match the examples in the documentation and, given that PHP7s interpolation uses less memory than concatenation, probably isn't intended.

This PR adds an exclude for that check and tries to make the docs a little more exact.


Originally posted by @kynx at zendframework/zend-coding-standard#18

[RFC]: Replacement for `SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint`

This references slevomat/coding-standard#1149

RFC

Q A
Proposed Version(s) 2.2.0
BC Break? No

Goal

Allow omitting docblock when provided from either parent objects or interfaces.

Background

I am implementing the coding standard in laminas-cache and I have the setup shown in the reference issue within slevomat coding standard.
As we have the same setup when implementing interfaces (and repeating docblock is bad practice imho), I'd like to replace the SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint with either a self-written sniff or an appropriate sniff which resolves interfaces and parent objects aswells.

This shoud not allow some kind of docblock merging. So code like this should be still considered invalid as the parameter $foo has no typehint:

<?php

interface Foo
{
    /**
     * @param string $foo
     * @param array $baz
     */
    public function bar($foo, array $bar): void;
}

class Baz implements Foo
{
    /**
     * @param array<string,mixed> $baz
     */
    public function bar($foo, array $bar): void
    {}
}

Considerations

There are no implications to the codebase as for now, the codestandard requires repetition of the docblock. In the future, this can be omitted.

Proposal(s)

  • Removal of SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint
  • Creation of an appropriate sniff or taking another sniff

Appendix

None, yet.

PHP 8.0 support

Feature Request

Q A
New Feature yes

Summary

To be prepared for the december release of PHP 8.0, this repository has some additional TODOs to be tested against the new major version.

In order to make this repository compatible, one has to follow these steps:

  • Modify composer.json to provide support for PHP 8.0 by adding the constraint ~8.0.0
  • Modify composer.json to drop support for PHP less than 7.3
  • Modify composer.json to implement phpunit 9.3 which supports PHP 7.3+
  • Modify .travis.yml to ignore platform requirements when installing composer dependencies (simply add --ignore-platform-reqs to COMPOSER_ARGS env variable)
  • Modify .travis.yml to add PHP 8.0 to the matrix (NOTE: Do not allow failures as PHP 8.0 has a feature freeze since 2020-08-04!)
  • Modify source code in case there are incompatibilities with PHP 8.0

Missing xml file

root@5c7fdcaf9404:/var/www# composer cs-check

phpcs
ERROR: Referenced sniff "./vendor/laminas/laminas-coding-standard/ruleset.xml" does not exist

Run "phpcs --help" for usage information

Script phpcs handling the cs-check event returned with error code 3

[2.0.0-alpha.3] Failed to fix: Reached maximum number of loops

This file causes maximum number of loops reached error with 2.0.0-alpha.3:
https://github.com/zendframework/zend-mvc/blob/d83d57e2e64e240e94efcc43d5b1483919cb65a0/src/View/Http/InjectTemplateListener.php

Related dependencies:

dealerdirect/phpcodesniffer-composer-installer v0.5.0
slevomat/coding-standard                       4.8.7
squizlabs/php_codesniffer                      3.4.0
webimpress/coding-standard                     dev-master dffb652
zendframework/zend-coding-standard             2.0.0-alpha.3

Offending part by the looks of it:
https://github.com/zendframework/zend-mvc/blob/d83d57e2e64e240e94efcc43d5b1483919cb65a0/src/View/Http/InjectTemplateListener.php#L108-L115

            if (// Allow disabling rule by setting value to false since config
                // merging have no feature to remove entries
                false == $replacement
                // Match full class or full namespace
                || ! ($controller === $namespace || strpos($controller, $namespace . '\\') === 0)
            ) {
                continue;
            }
 => Fixing file: 0/38 violations remaining [made 45 passes]...   * fixed 0 violations, starting loop 46 *
WebimpressCodingStandard\Sniffs\Commenting\PlacementSniff (line 41) replaced token 838 (T_COMMENT) "//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" => "·//·Allow·disabling·rule·by·setting·value·to·false·since·config\n"
=> Fixing file: 1/38 violations remaining [made 46 passes]...   * fixed 1 violations, starting loop 47 *
**** PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 105) has possible conflict with another sniff on loop 45; caused by the following change ****
**** replaced token 838 (T_WHITESPACE) "·//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" => "//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" ****
**** ignoring all changes until next loop ****
=> Fixing file: 0/38 violations remaining [made 47 passes]...   * fixed 0 violations, starting loop 48 *
PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 105) replaced token 838 (T_WHITESPACE) "·//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" => "//·Allow·disabling·rule·by·setting·value·to·false·since·config\n"
=> Fixing file: 1/38 violations remaining [made 48 passes]...   * fixed 1 violations, starting loop 49 *
**** WebimpressCodingStandard\Sniffs\Commenting\PlacementSniff (line 41) has possible conflict with another sniff on loop 47; caused by the following change ****
**** replaced token 838 (T_COMMENT) "//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" => "·//·Allow·disabling·rule·by·setting·value·to·false·since·config\n" ****
**** ignoring all changes until next loop ****

Originally posted by @Xerkus at zendframework/zend-coding-standard#14

Updates for documentation needed

Bug Report

  • wrong installation command
  • wrong site description
  • the page "Coding Style Guide" is too long
  • wrong indentation in lists for code examples
  • wrong formatting in blockquotes
  • wrong or no syntax for links
  • unneeded PHP tags
  • unneeded numbering in headlines
  • invalid the very first code example in v2 docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.