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

Feature alpha5 #12

Merged
merged 5 commits into from Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 45 additions & 28 deletions .travis.yml
@@ -1,41 +1,58 @@
language: php

php:
- 7.1
- 7.2
- 7.3

cache:
directories:
- $HOME/.composer/cache

before_install:
- composer self-update
env:
global:
- COMPOSER_ARGS="--no-interaction"

install: travis_retry composer update --prefer-dist
matrix:
fast_finish: true
include:
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=latest
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=latest
- php: 7.4
env:
- DEPS=lowest
- php: 7.4
env:
- DEPS=latest

addons:
apt:
packages:
- libxml2-utils

script:
- vendor/bin/phpcs
- vendor/bin/phpcs $(find test/fixable/* | sort) --report=summary --report-file=phpcs.log; diff test/expected-report.txt phpcs.log
before_install:
- phpenv config-rm xdebug.ini || return 0

stages:
- Validate against schema
- Validate fixes
- Test
install:
- travis_retry composer install $COMPOSER_ARGS
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- stty cols 120 && composer show

jobs:
include:
- stage: Validate against schema
addons:
apt:
packages:
- libxml2-utils
script: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd src/LaminasCodingStandard/ruleset.xml

- stage: Validate fixes
before_script:
- cp -R test/fixable/ test/fix/
script: vendor/bin/phpcbf test/fix; diff test/fix test/fixed
script:
- xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd src/LaminasCodingStandard/ruleset.xml
- composer check

notifications:
email: false
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (c) 2019, Laminas Foundation
Copyright (c) 2019-2020, Laminas Foundation
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -30,8 +30,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"laminas/laminas-zendframework-bridge": "^1.0",
"slevomat/coding-standard": "^5.0.4",
"squizlabs/php_codesniffer": "^3.5.1",
"webimpress/coding-standard": "^1.0.5"
"squizlabs/php_codesniffer": "^3.5.3",
"webimpress/coding-standard": "~1.0.6"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v2/coding-style-guide.md
Expand Up @@ -28,7 +28,7 @@ This example encompasses some of the rules below as a quick overview:
<?php
/**
* @see https://github.com/mezzio/mezzio for the canonical source repository
* @copyright Copyright (c) 2015-2018 Laminas (https://www.zend.com)
* @copyright https://github.com/mezzio/mezzio/blob/master/COPYRIGHT.md
* @license https://github.com/mezzio/mezzio/blob/master/LICENSE.md New BSD License
*/

Expand Down
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd"
name="ZendCodingStandard">
<description>The Zend Framework coding standard.</description>
name="LaminasCodingStandard">
<description>The Laminas coding standard.</description>

<!-- 1. Overview -->

Expand All @@ -24,7 +24,7 @@
the first letter of each word is capitalized including the very first
letter. -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MAY NOT be any content before the opening tag. -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
Expand Down Expand Up @@ -100,7 +100,7 @@
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<!-- checked by PSR2.Files.ClosingTag -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- The declare(strict_types=1) directive MUST be declared and be the
first statement in a file. -->
Expand All @@ -123,7 +123,7 @@
<!-- There MUST NOT be more than one statement per line. -->
<!-- checked by Generic.Formatting.DisallowMultipleStatements -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MAY be maximum one blank line to improve readability and to
indicate related blocks of code except where explicitly forbidden. -->
Expand All @@ -140,7 +140,7 @@
<!-- checked by Generic.WhiteSpace.ScopeIndent -->
<!-- checked by Generic.WhiteSpace.DisallowTabIndent -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- Encapsed strings MAY be used instead of concatenating strings. When
concatenating strings, there MUST be a single whitespace before and
Expand Down Expand Up @@ -176,14 +176,14 @@

<!-- 2.6 Variables -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- Variable names MUST be declared in camelCase. -->
<rule ref="WebimpressCodingStandard.NamingConventions.ValidVariableName"/>

<!-- 2.7 Arrays -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- The short array syntax MUST be used to define arrays. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
Expand Down Expand Up @@ -247,7 +247,7 @@
<!-- Block declare statements are allowed and MUST be formatted as below. -->
<!-- checked by PSR12.Files.DeclareStatement -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- TODO: Declare statements must be after the File level docblock if present. -->

Expand Down Expand Up @@ -290,7 +290,7 @@
even when there are no arguments passed to the constructor. -->
<!-- checked by PSR12.Classes.ClassInstantiation -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MUST NOT be duplicate class names. -->
<rule ref="Generic.Classes.DuplicateClassName"/>
Expand Down Expand Up @@ -351,7 +351,7 @@
taking note of indentation, spacing, and new lines. -->
<!-- checked by PSR12.Traits.UseDeclaration -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- Traits MUST be sorted alphabetically. -->
<rule ref="WebimpressCodingStandard.Classes.AlphabeticallySortedTraits"/>
Expand All @@ -371,7 +371,7 @@
minimum version supports constant visibilities (PHP 7.1 or later). -->
<!-- checked by PSR12.Properties.ConstantVisibility -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- Default null values MUST be omitted for class properties. -->
<rule ref="WebimpressCodingStandard.Classes.NoNullValues"/>
Expand All @@ -396,7 +396,7 @@
<!-- checked by Squiz.Functions.FunctionDeclaration -->
<!-- checked by Squiz.Functions.LowercaseFunctionKeywords -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MUST be a single empty line between methods in a class. -->
<rule ref="WebimpressCodingStandard.Methods.LineAfter"/>
Expand Down Expand Up @@ -444,7 +444,7 @@
question mark and the type. -->
<!-- checked by PSR12.Functions.NullableTypeDeclaration -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- The question mark MUST be used when the default argument value is null. -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
Expand All @@ -457,7 +457,7 @@
declaration. -->
<!-- checked by PSR2.Methods.MethodDeclaration -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- The final keyword on methods MUST be omitted in final classes. -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
Expand Down Expand Up @@ -501,7 +501,7 @@
<!-- checked by Generic.ControlStructures.InlineControlStructure -->
<!-- checked by WebimpressCodingStandard.WhiteSpace.BraceBlankLine -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There SHOULD be one single space after `break` and `continue` structures with
a numeric argument argument. -->
Expand Down Expand Up @@ -550,7 +550,7 @@
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- The `continue` control structure MUST NOT be used in switch statements,
`break` SHOULD be used instead. -->
Expand Down Expand Up @@ -599,7 +599,7 @@

<!-- 5.6 try, catch, finally -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- All catch blocks MUST be reachable. -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
Expand All @@ -610,7 +610,7 @@
used for readability purposes. -->
<!-- All operators not described here are left undefined. -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MUST be at least one space on either side of an equals sign used
to assign a value to a variable. In case of a block of related
Expand Down Expand Up @@ -654,7 +654,7 @@
<!-- Type casting operators MUST NOT have any space within the parentheses. -->
<!-- checked by Squiz.WhiteSpace.CastSpacing -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- There MUST be one whitespace after a type casting operator. -->
<rule ref="Generic.Formatting.SpaceAfterCast"/>
Expand Down Expand Up @@ -706,7 +706,7 @@
the two characters. -->
<!-- checked by PSR12.Functions.ReturnTypeDeclaration -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- Inherited variables passed via `use` MUST be used in closures. -->
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
Expand All @@ -723,7 +723,7 @@

<!-- 9. Commenting and DocBlocks -->

<!-- Additional Zend Framework rules -->
<!-- Additional Laminas rules -->

<!-- DocBlocks and comments SHOULD only be used if necessary. Code SHOULD
be written so it explains itself. They MUST NOT start with `#` and MUST
Expand Down