Skip to content

Commit 7f4bacc

Browse files
committed
Initial commit
0 parents  commit 7f4bacc

File tree

11 files changed

+295
-0
lines changed

11 files changed

+295
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/tests/ export-ignore
2+
/.editorconfig export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.php_cs.dist export-ignore
6+
/.travis.yml export-ignore

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.php_cs
2+
/.php_cs.cache
3+
/composer.lock
4+
/vendor/

.php_cs.dist

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of PHP CS Fixer.
5+
6+
(c) Fabien Potencier <[email protected]>
7+
Dariusz Rumiński <[email protected]>
8+
9+
This source file is subject to the MIT license that is bundled
10+
with this source code in the file LICENSE.
11+
EOF;
12+
13+
$finder = PhpCsFixer\Finder::create()
14+
->exclude('tests/Fixtures')
15+
->in(__DIR__)
16+
;
17+
18+
if (PHP_VERSION_ID < 70000) {
19+
$finder
20+
->notPath('tests/Test/Constraint/XmlMatchesXsdForV7.php')
21+
;
22+
}
23+
24+
return PhpCsFixer\Config::create()
25+
->setRiskyAllowed(true)
26+
->setRules([
27+
'@PHP56Migration' => true,
28+
'@PHPUnit60Migration:risky' => true,
29+
'@Symfony' => true,
30+
'@Symfony:risky' => true,
31+
'align_multiline_comment' => true,
32+
'array_indentation' => true,
33+
'array_syntax' => ['syntax' => 'short'],
34+
'blank_line_before_statement' => true,
35+
'combine_consecutive_issets' => true,
36+
'combine_consecutive_unsets' => true,
37+
'comment_to_phpdoc' => true,
38+
'compact_nullable_typehint' => true,
39+
'escape_implicit_backslashes' => true,
40+
'explicit_indirect_variable' => true,
41+
'explicit_string_variable' => true,
42+
'final_internal_class' => true,
43+
'fully_qualified_strict_types' => true,
44+
'function_to_constant' => ['functions' => ['get_class', 'get_called_class', 'php_sapi_name', 'phpversion', 'pi']],
45+
'header_comment' => ['header' => $header],
46+
'heredoc_to_nowdoc' => true,
47+
'list_syntax' => ['syntax' => 'long'],
48+
'method_argument_space' => ['ensure_fully_multiline' => true],
49+
'method_chaining_indentation' => true,
50+
'multiline_comment_opening_closing' => true,
51+
'no_alternative_syntax' => true,
52+
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
53+
'no_null_property_initialization' => true,
54+
'no_short_echo_tag' => true,
55+
'no_superfluous_elseif' => true,
56+
'no_unneeded_curly_braces' => true,
57+
'no_unneeded_final_method' => true,
58+
'no_unreachable_default_argument_value' => true,
59+
'no_useless_else' => true,
60+
'no_useless_return' => true,
61+
'ordered_class_elements' => true,
62+
'ordered_imports' => true,
63+
'php_unit_ordered_covers' => true,
64+
'php_unit_set_up_tear_down_visibility' => true,
65+
'php_unit_strict' => true,
66+
'php_unit_test_annotation' => true,
67+
'php_unit_test_class_requires_covers' => true,
68+
'phpdoc_add_missing_param_annotation' => true,
69+
'phpdoc_order' => true,
70+
'phpdoc_types_order' => true,
71+
'semicolon_after_instruction' => true,
72+
'single_line_comment_style' => true,
73+
'strict_comparison' => true,
74+
'strict_param' => true,
75+
'string_line_ending' => true,
76+
'yoda_style' => true,
77+
])
78+
->setFinder($finder)
79+
;

.travis.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
sudo: false
2+
3+
git:
4+
depth: 1
5+
6+
cache:
7+
directories:
8+
- $HOME/.composer
9+
10+
language: php
11+
12+
php:
13+
- 5.5
14+
- 5.6
15+
- 7.0
16+
- 7.1
17+
- 7.2
18+
- nightly
19+
20+
env:
21+
global:
22+
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress"
23+
- COMPOSER_FLAGS=""
24+
25+
stages:
26+
- Static Code Analysis
27+
- Test
28+
29+
before_install:
30+
# turn off XDebug
31+
- phpenv config-rm xdebug.ini || return 0
32+
33+
# Composer: boost installation
34+
- composer global show -ND 2>&1 | grep "hirak/prestissimo" || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
35+
36+
install:
37+
- composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
38+
39+
script:
40+
- vendor/bin/phpunit
41+
42+
jobs:
43+
include:
44+
-
45+
stage: Static Code Analysis
46+
php: 7.2
47+
script:
48+
- composer validate --strict || travis_terminate 1
49+
- composer normalize --dry-run || travis_terminate 1
50+
- vendor/bin/phpmd src,tests text phpmd.xml || travis_terminate 1
51+
- vendor/bin/php-cs-fixer fix --diff --dry-run -v || travis_terminate 1

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018-now Dariusz Rumiński
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is furnished
10+
to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

composer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "php-cs-fixer/phpunit-constraint-xmlmatchesxsd",
3+
"type": "library",
4+
"description": "Constraint for testing XML against XSD.",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Dariusz Rumiński",
9+
"email": "[email protected]"
10+
},
11+
{
12+
"name": "SpacePossum"
13+
}
14+
],
15+
"require": {
16+
"php": "^5.5 || ^7.0",
17+
"phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0",
18+
"phpunitgoodpractices/polyfill": "^1.0",
19+
"phpunitgoodpractices/traits": "^1.3.2",
20+
"symfony/phpunit-bridge": "^3.2.2 || ^4.0"
21+
},
22+
"conflict": {
23+
"hhvm": "*"
24+
},
25+
"require-dev": {
26+
"friendsofphp/php-cs-fixer": "^2.11",
27+
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0",
28+
"localheinz/composer-normalize": "^0.6.0",
29+
"maglnet/composer-require-checker": "^0.1.6",
30+
"mi-schi/phpmd-extension": "^4.2.1",
31+
"phpmd/phpmd": "^2.6.0"
32+
},
33+
"config": {
34+
"sort-packages": true
35+
},
36+
"autoload": {
37+
"psr-4": {
38+
"PhpCsFixer\\PhpunitConstraintXmlMatchesXsd\\": "src/"
39+
},
40+
"files": [
41+
"src/Constraint/XmlMatchesXsd.php"
42+
]
43+
},
44+
"autoload-dev": {
45+
"psr-4": {
46+
"PhpCsFixer\\PhpunitConstraintXmlMatchesXsd\\Tests\\": "tests/"
47+
}
48+
}
49+
}

phpmd.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="friendsofphp/php-cs-fixer"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
6+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
7+
>
8+
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
9+
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
10+
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
11+
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
12+
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />
13+
14+
<rule ref="rulesets/design.xml/DevelopmentCodeFragment" />
15+
<rule ref="rulesets/design.xml/EvalExpression" />
16+
<rule ref="rulesets/design.xml/ExitExpression" />
17+
<rule ref="rulesets/design.xml/GotoStatement" />
18+
19+
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
20+
21+
<rule ref="../../../../../mi-schi/phpmd-extension/rulesets/cleancode.xml/DataStructureMethods" />
22+
<rule ref="../../../../../mi-schi/phpmd-extension/rulesets/cleancode.xml/SwitchStatement" />
23+
24+
<rule ref="../../../../../mi-schi/phpmd-extension/rulesets/naming.xml/CommentDescription">
25+
<properties>
26+
<property name="percent" value="70" />
27+
</properties>
28+
</rule>
29+
</ruleset>

phpunit.xml.dist

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit
4+
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
backupGlobals="false"
7+
backupStaticAttributes="false"
8+
beStrictAboutChangesToGlobalState="true"
9+
beStrictAboutOutputDuringTests="true"
10+
beStrictAboutTestSize="true"
11+
beStrictAboutTestsThatDoNotTestAnything="true"
12+
beStrictAboutTodoAnnotatedTests="true"
13+
bootstrap="./vendor/autoload.php"
14+
colors="true"
15+
columns="max"
16+
convertErrorsToExceptions="true"
17+
convertNoticesToExceptions="true"
18+
convertWarningsToExceptions="true"
19+
processIsolation="false"
20+
stopOnFailure="false"
21+
verbose="true"
22+
>
23+
<testsuites>
24+
<testsuite>
25+
<directory>./tests</directory>
26+
</testsuite>
27+
</testsuites>
28+
29+
<filter>
30+
<whitelist>
31+
<directory>./src</directory>
32+
</whitelist>
33+
</filter>
34+
35+
<listeners>
36+
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
37+
<arguments>
38+
<array>
39+
<element key="slowThreshold">
40+
<integer>100</integer>
41+
</element>
42+
</array>
43+
</arguments>
44+
</listener>
45+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
46+
</listeners>
47+
</phpunit>

src/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)