Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.0.0-alpha3 #71

Merged
merged 57 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
254d824
CI: switch to fork of Parallel-lint package
jrfnl Mar 10, 2020
d6aaf8c
Merge pull request #39 from PHPCSStandards/feature/use-parallel-lint-…
jrfnl Mar 10, 2020
0a63926
:sparkles: New `Universal.Arrays.DisallowShortArraySyntax` sniff
jrfnl Mar 14, 2020
54e7faf
Merge pull request #40 from PHPCSStandards/feature/new-disallow-short…
jrfnl Mar 14, 2020
771827e
Travis: add a test run against PHPCS 4.x-dev
jrfnl Mar 18, 2020
c00549f
Merge pull request #41 from PHPCSStandards/feature/travis-test-agains…
jrfnl Mar 18, 2020
70ffed9
:sparkles: New `Universal.Operators.DisallowShortTernary` sniff
jrfnl Mar 30, 2020
9e83ab0
Merge pull request #42 from PHPCSStandards/feature/universal/disallow…
jrfnl Mar 31, 2020
b64ab63
Travis: fix the build
jrfnl Mar 31, 2020
b76e23a
Merge pull request #44 from PHPCSStandards/feature/travis-fix-stages
jrfnl Mar 31, 2020
25e84d4
:sparkles: New `Universal.WhiteSpace.DisallowInlineTabs` sniff
jrfnl Mar 31, 2020
04f9414
Merge pull request #43 from PHPCSStandards/feature/universal/new-disa…
jrfnl Mar 31, 2020
51e0f67
DisallowInlineTabs: bug fix / indentation vs annotation
jrfnl Apr 5, 2020
470a398
Merge pull request #45 from PHPCSStandards/feature/disallowinlinetabs…
jrfnl Apr 5, 2020
06c3f0c
DisallowInlineTabs: improve code sample in docs
jrfnl Apr 12, 2020
426fe8f
Merge pull request #47 from PHPCSStandards/feature/disallowinlinetabs…
jrfnl Apr 12, 2020
ec6db2b
:sparkles: New `Universal.Operators.StrictComparisons` sniff
jrfnl Apr 12, 2020
1fbc526
:sparkles: New `Universal.UseStatements.NoLeadingBackslash` sniff
jrfnl Apr 12, 2020
909b2f9
Merge pull request #46 from PHPCSStandards/feature/new-usestatements-…
jrfnl Apr 12, 2020
cdbc95f
Merge pull request #48 from PHPCSStandards/feature/new-strict-compari…
jrfnl Apr 12, 2020
5b5cb9c
Universal/NoLeadingBackslash: add metrics
jrfnl Apr 12, 2020
1107c9c
Merge pull request #49 from PHPCSStandards/feature/noleadingbackslash…
jrfnl Apr 12, 2020
53b742f
:sparkles: New `Universal.Namespaces.DisallowDeclarationWithoutName` …
jrfnl Apr 13, 2020
f383494
Merge pull request #50 from PHPCSStandards/feature/new-namespaces-dis…
jrfnl Apr 13, 2020
9c5441f
:sparkles: New `Universal.Operators.DisallowLogicalAndOr` sniff
jrfnl Apr 16, 2020
44f5bfb
Universal/StrictComparisons: add metrics
jrfnl Apr 16, 2020
f6874ac
Merge pull request #53 from PHPCSStandards/feature/strictcomparisons-…
jrfnl Apr 16, 2020
96bbc93
Merge pull request #52 from PHPCSStandards/feature/new-disallowlogica…
jrfnl Apr 16, 2020
766c4ec
:sparkles: New `Universal.OOStructures.AlphabeticExtendsImplements` s…
jrfnl Apr 29, 2020
b33bc6a
Composer: set minimum Composer PHPCS plugin dependency version to `0.…
jrfnl May 5, 2020
36e077b
Merge pull request #56 from PHPCSStandards/feature/fix-phpcs-composer…
jrfnl May 5, 2020
c2c4aeb
Merge pull request #55 from PHPCSStandards/feature/54-new-alphabetici…
jrfnl May 10, 2020
29ecc38
NoLeadingBackslash: fix filename of fixed test case file
jrfnl May 16, 2020
c47150b
:sparkles: New `Universal.UseStatements.LowercaseFunctionConst` sniff
jrfnl May 16, 2020
33631fa
Merge pull request #57 from PHPCSStandards/feature/noleadingbackslash…
jrfnl May 16, 2020
1de0847
Merge pull request #58 from PHPCSStandards/universal/usestatements/ne…
jrfnl May 16, 2020
2eca0cf
DisallowShortArraySyntax: register fewer tags
jrfnl Jun 23, 2020
ae8954e
DisallowShortListSyntax: register fewer tags
jrfnl Jun 23, 2020
323b620
Merge pull request #61 from PHPCSStandards/feature/disallowshortarray…
jrfnl Jun 23, 2020
8997f5a
Composer: update PHPCS Composer plugin dependency
jrfnl Jun 27, 2020
e82f9eb
Merge pull request #62 from PHPCSStandards/feature/allow-for-new-comp…
jrfnl Jun 27, 2020
d5bbc04
QA/CI: change the way the CS check is run
jrfnl Jun 28, 2020
6ad26e7
Merge pull request #63 from PHPCSStandards/feature/change-cs-setup
jrfnl Jun 28, 2020
912c18c
:sparkles: New `Universal.Constants.UppercaseMagicConstants` sniff
jrfnl Mar 13, 2020
2d5cd95
:sparkles: New `Universal.Operators.DisallowStandalonePostIncrementDe…
jrfnl Apr 6, 2020
beffa60
Merge pull request #64 from PHPCSStandards/feature/universal/new-uppe…
jrfnl Jun 29, 2020
9ebc9a7
Merge pull request #65 from PHPCSStandards/feature/universal/new-disa…
jrfnl Jun 29, 2020
1eb2b5d
Travis: test on nightly
jrfnl Jun 29, 2020
acdfca6
Test bootstrap: improve documentation and some minor code tweaks
jrfnl Jun 29, 2020
767b721
Merge pull request #67 from PHPCSStandards/feature/test-bootstrap-min…
jrfnl Jun 29, 2020
e097ef6
Merge pull request #66 from PHPCSStandards/feature/travis-test-on-nig…
jrfnl Jun 29, 2020
22a3316
Misc updates for the `master` branch being renamed to `stable`
jrfnl Jun 10, 2020
9a7b51b
Composer: update dependencies
jrfnl Jun 29, 2020
f3b0573
Merge pull request #69 from PHPCSStandards/feature/update-misc-depend…
jrfnl Jun 29, 2020
010cc15
Changelog and readme updates for release `1.0.0-alpha3`
jrfnl May 27, 2020
bb61372
Merge pull request #68 from PHPCSStandards/feature/rename-master-branch
jrfnl Jun 29, 2020
51e0cb4
Merge pull request #70 from PHPCSStandards/feature/changelog-1.0.0-al…
jrfnl Jun 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 40 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ php:

env:
jobs:
# `master`
# PHPCS `master`.
- PHPCS_VERSION="dev-master" LINT=1
# Lowest supported PHPCS version.
- PHPCS_VERSION="3.3.1"
Expand All @@ -32,19 +32,28 @@ env:
# See: https://docs.travis-ci.com/user/conditions-v1
stages:
- name: sniff
- name: validate
- name: quicktest
if: type = push AND branch NOT IN (master, develop)
if: type = push AND branch NOT IN (stable, develop)
- name: test
if: branch IN (master, develop)
if: branch IN (stable, develop)
- name: coverage
if: branch IN (master, develop)
if: branch IN (stable, develop)

jobs:
fast_finish: true

include:
#### SNIFF STAGE ####
- stage: sniff
php: 7.4
install: skip
before_script: skip
script:
# Check the code style of the code base.
- composer travis-checkcs

- stage: validate
php: 7.4
env: PHPCS_VERSION="dev-master"
addons:
Expand All @@ -56,9 +65,6 @@ jobs:
# @link https://getcomposer.org/doc/03-cli.md#validate
- composer validate --no-check-all --strict

# Check the code style of the code base.
- composer travis-checkcs

# Validate the xml files.
# @link http://xmlsoft.org/xmllint.html
- xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./NormalizedArrays/ruleset.xml
Expand Down Expand Up @@ -96,8 +102,11 @@ jobs:
- php: 7.3
env: PHPCS_VERSION="dev-master" LINT=1

- php: 7.4
env: PHPCS_VERSION="4.0.x-dev@dev"

- php: "nightly"
env: PHPCS_VERSION="n/a" LINT=1
env: PHPCS_VERSION="dev-master" LINT=1

#### CODE COVERAGE STAGE ####
# N.B.: Coverage is only checked on the lowest and highest stable PHP versions for all PHPCS versions.
Expand All @@ -117,12 +126,13 @@ jobs:
allow_failures:
# Allow failures for unstable builds.
- php: "nightly"
- env: PHPCS_VERSION="4.0.x-dev@dev"


before_install:
# Speed up build time by disabling Xdebug when its not needed.
- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Coverage" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Coverage" ]]; then
phpenv config-rm xdebug.ini || echo 'No xdebug config.'
fi

Expand All @@ -131,35 +141,37 @@ before_install:
# On stable PHPCS versions, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Sniff" && $PHPCS_BRANCH != "dev-master" && "$PHPCS_VERSION" != "n/a" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && $PHPCS_BRANCH != "dev-master" ]]; then
echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
fi


install:
# Set up test environment using Composer.
- composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION}
- |
if [[ $PHPCS_VERSION != "n/a" ]]; then
composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION}
fi
- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Coverage" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" ]]; then
composer require --no-update --no-suggest --no-scripts php-coveralls/php-coveralls:${COVERALLS_VERSION}
fi

- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Sniff" || $PHPCS_VERSION == "n/a" ]]; then
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
# The build on nightly also doesn't run the tests (yet).
composer remove --dev phpunit/phpunit --no-update --no-scripts
if [[ "${PHPCS_VERSION:0:3}" == "4.0" ]]; then
# Remove devtools as it will not (yet) install on PHPCS 4.x.
composer remove --dev phpcsstandards/phpcsdevtools --no-update
# --prefer-source ensures that the PHPCS native unit test framework will be available in PHPCS 4.x.
composer install --prefer-source --no-suggest
elif [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
# Ignore PHPUnit platform requirements for installing on nightly.
composer install --prefer-dist --no-suggest --ignore-platform-reqs
else
# --prefer-dist will allow for optimal use of the travis caching ability.
composer install --prefer-dist --no-suggest
fi

# --prefer-dist will allow for optimal use of the travis caching ability.
# The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS.
- composer install --prefer-dist --no-suggest
# The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS.


before_script:
- if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Coverage" ]]; then mkdir -p build/logs; fi
- if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" ]]; then mkdir -p build/logs; fi
- phpenv rehash


Expand All @@ -169,18 +181,18 @@ script:

# Run the unit tests.
- |
if [[ $PHPCS_VERSION != "n/a" && "$TRAVIS_BUILD_STAGE_NAME" != "Coverage" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Coverage" ]]; then
composer test
elif [[ $PHPCS_VERSION != "n/a" && "$TRAVIS_BUILD_STAGE_NAME" == "Coverage" ]]; then
elif [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" ]]; then
composer coverage
fi

after_success:
- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Coverage" && $COVERALLS_VERSION == "^1.0" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" && $COVERALLS_VERSION == "^1.0" ]]; then
php vendor/bin/coveralls -v -x build/logs/clover.xml
fi
- |
if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Coverage" && $COVERALLS_VERSION == "^2.0" ]]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" && $COVERALLS_VERSION == "^2.0" ]]; then
php vendor/bin/php-coveralls -v -x build/logs/clover.xml
fi
51 changes: 49 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,54 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses

_Nothing yet._

## [1.0.0-alpha3] - 2020-06-29

## 1.0.0-alpha2 - 2020-02-18
### Added

#### Universal

* :wrench: :books: New `Universal.Arrays.DisallowShortArraySyntax` sniff to disallow short array syntax. [#40](https://github.com/PHPCSStandards/PHPCSExtra/pull/40)
In contrast to the PHPCS native `Generic.Arrays.DisallowShortArraySyntax` sniff, this sniff will ignore short list syntax and not cause parse errors when the fixer is used.
* :wrench: :bar_chart: :books: New `Universal.Constants.UppercaseMagicConstants` sniff to enforce that PHP native magic constants are in uppercase. [#64](https://github.com/PHPCSStandards/PHPCSExtra/pull/64)
* :bar_chart: :books: New `Universal.Namespaces.DisallowDeclarationWithoutName` sniff to disallow namespace declarations without a namespace name. [#50](https://github.com/PHPCSStandards/PHPCSExtra/pull/50)
* :bar_chart: :books: New `Universal.Operators.DisallowLogicalAndOr` sniff to enforce the use of the boolean `&&` and `||` operators instead of the logical `and`/`or` operators. [#52](https://github.com/PHPCSStandards/PHPCSExtra/pull/52)
Note: as the [operator precedence](https://www.php.net/manual/en/language.operators.precedence.php) of the logical operators is significantly lower than the operator precedence of boolean operators, this sniff does not contain an auto-fixer.
* :bar_chart: :books: New `Universal.Operators.DisallowShortTernary` sniff to disallow the use of short ternaries `?:`. [#42](https://github.com/PHPCSStandards/PHPCSExtra/pull/42)
While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices.
* :wrench: :bar_chart: :books: New `Universal.Operators.DisallowStandalonePostIncrementDecrement` sniff disallow the use of post-in/decrements in stand-alone statements and discourage the use of multiple increment/decrement operators in a stand-alone statement. [#65](https://github.com/PHPCSStandards/PHPCSExtra/pull/65)
* :wrench: :bar_chart: :books: New `Universal.Operators.StrictComparisons` sniff to enforce the use of strict comparisons. [#48](https://github.com/PHPCSStandards/PHPCSExtra/pull/48)
Warning: the auto-fixer for this sniff _may_ cause bugs in applications and should be used with care! This is considered a _risky_ fixer.
* :wrench: :bar_chart: :books: New `Universal.OOStructures.AlphabeticExtendsImplements` sniff to verify that the names used in a class "implements" statement or an interface "extends" statement are listed in alphabetic order. [#55](https://github.com/PHPCSStandards/PHPCSExtra/pull/55)
* This sniff contains a public `orderby` property to determine the sort order to use for the statement.
If all names used are unqualified, the sort order won't make a difference.
However, if one or more of the names are partially or fully qualified, the chosen sort order will determine how the sorting between unqualified, partially and fully qualified names is handled.
The sniff supports two sort order options:
- _'name'_ : sort by the interface name only (default);
- _'full'_ : sort by the full name as used in the statement (without leading backslash).
In both cases, the sorting will be done using natural sort, case-insensitive.
* The sniff has modular error codes to allow for selective inclusion/exclusion:
- `ImplementsWrongOrder` - for "class implements" statements.
- `ImplementsWrongOrderWithComments` - for "class implements" statements interlaced with comments. These will not be auto-fixed.
- `ExtendsWrongOrder` - for "interface extends" statements.
- `ExtendsWrongOrderWithComments` - for "interface extends" statements interlaced with comments. These will not be auto-fixed.
* When fixing, the existing spacing between the names in an `implements`/`extends` statement will not be maintained.
The fixer will separate each name with a comma and one space.
If alternative formatting is desired, a sniff which will check and fix the formatting should be added to the ruleset.
* :wrench: :bar_chart: :books: New `Universal.UseStatements.LowercaseFunctionConst` sniff to enforce that `function` and `const` keywords when used in an import `use` statement are always lowercase. [#58](https://github.com/PHPCSStandards/PHPCSExtra/pull/58)
* :wrench: :bar_chart: :books: New `Universal.UseStatements.NoLeadingBackslash` sniff to verify that a name being imported in an import `use` statement does not start with a leading backslash. [#46](https://github.com/PHPCSStandards/PHPCSExtra/pull/46)
Names in import `use` statements should always be fully qualified, so a leading backslash is not needed and it is strongly recommended not to use one.
This sniff handles all types of import use statements supported by PHP, in contrast to other sniffs for the same in, for instance, the PSR12 or the Slevomat standard, which are incomplete.
* :wrench: :books: New `Universal.WhiteSpace.DisallowInlineTabs` sniff to enforce using spaces for mid-line alignment. [#43](https://github.com/PHPCSStandards/PHPCSExtra/pull/43)

### Changed

#### Other
* The `master` branch has been renamed to `stable`.
* Composer: The version requirements for the [DealerDirect Composer PHPCS plugin] have been widened to allow for version 0.7.0 which supports Composer 2.0.0. [#62](https://github.com/PHPCSStandards/PHPCSExtra/pull/62)
* Various housekeeping.


## [1.0.0-alpha2] - 2020-02-18

### Added

Expand Down Expand Up @@ -104,5 +150,6 @@ This initial alpha release contains the following sniffs:
Individual sub-types can be allowed by excluding specific error codes.


[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha2...HEAD
[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD
[1.0.0-alpha3]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha2...1.0.0-alpha3
[1.0.0-alpha2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha1...1.0.0-alpha2
Loading