yiisoft / yii2-coding-standards

Yii 2 coding standards
182 stars 49 forks source link

phpcs 3.0 refactor #32

Closed krukru closed 6 years ago

krukru commented 7 years ago

Phpcs has just released version 3.0 which breaks BC for custom sniffs.

This is the first stable release of the 3.0 branch, and is a large refactoring of the code base. It breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide

This PR updates the version of phpcs to 3.0, adds namespaces and changes some class names to be compatible with the new version. It also adds some tests.

I wasn't really sure whether the namespace should be

namespace PHP_CodeSniffer\Standards\Yii2\Sniffs\Files;

or

namespace Yii2\Sniffs\Files;

I went with the former because tests wouldn't run otherwise and it's also consistent with the way phpcs uses namespaces for their built-in Standards (for example, see https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php)

Any comments?

samdark commented 7 years ago

Related to https://github.com/yiisoft/yii2/pull/14100

samdark commented 7 years ago

https://github.com/yiisoft/yii2/pull/14100 was merged.

mikk150 commented 6 years ago

what is the status of this PR?

samdark commented 6 years ago

Wasn't properly tested/verified. If you want to do it, feel free to.

razvanphp commented 6 years ago

Installing seems to be working...

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Updating squizlabs/php_codesniffer (2.9.1 => 3.2.3): Loading from cache
  - Updating yiisoft/yii2-coding-standards (2.0.3 => dev-phpcs-3.0/refactor ce14ee0):  Checking out ce14ee0211
Writing lock file
Generating autoload files

but the errors like

String "CURRENT_TIMESTAMP" does not require double quotes; use single quotes instead

are gone, so clearly something is wrong. How can I run the tests?