Skip to content

Commit af80200

Browse files
committed
WIP: initial import; some classes still have external dependencies
1 parent 7beda58 commit af80200

20 files changed

+1309
-0
lines changed

.php_cs.dist

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
;
9+
10+
return PhpCsFixer\Config::create()
11+
->setRules([
12+
'@PSR12' => true,
13+
])
14+
->setFinder($finder)
15+
;

.travis.yml

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
sudo: required
2+
3+
language: php
4+
5+
# Stage order
6+
stages:
7+
- pre-conditions
8+
- test
9+
- quality
10+
11+
12+
################
13+
# Test stage #
14+
################
15+
16+
php:
17+
- 7.4
18+
- 8.0
19+
20+
env:
21+
- COMMAND="composer install"
22+
- COMMAND="composer update"
23+
24+
before_script:
25+
- ${COMMAND}
26+
27+
script:
28+
- php vendor/bin/phpunit --no-coverage
29+
30+
jobs:
31+
fast_finish: true
32+
allow_failures:
33+
- php: 7.4
34+
env: Psalm
35+
- php: 7.4
36+
env: Security check (composer install)
37+
- php: 7.4
38+
env: Security check (composer update)
39+
- php: 7.4
40+
env: PHP Codesniffer
41+
42+
include:
43+
44+
##########################
45+
# Pre-conditions stage #
46+
##########################
47+
48+
- stage: pre-conditions
49+
php: 7.4
50+
env: Syntax check PHP
51+
before_script:
52+
- composer install
53+
script:
54+
- vendor/bin/check-syntax-php.sh
55+
56+
- stage: pre-conditions
57+
php: 8.0
58+
env: Syntax check PHP
59+
before_script:
60+
- composer install
61+
script:
62+
- vendor/bin/check-syntax-php.sh
63+
64+
- stage: pre-conditions
65+
env: Syntax check YAML / XML / JSON
66+
before_script:
67+
- composer update
68+
script:
69+
- vendor/bin/check-syntax-yaml.sh
70+
- vendor/bin/check-syntax-xml.sh
71+
- vendor/bin/check-syntax-json.sh
72+
73+
74+
###################
75+
# Quality stage #
76+
###################
77+
78+
- stage: quality
79+
php: 7.4
80+
env: Security check (composer install)
81+
before_script:
82+
- composer install
83+
script:
84+
- vendor/bin/security-checker security:check
85+
86+
- stage: quality
87+
php: 7.4
88+
env: Security check (composer update)
89+
before_script:
90+
- composer update
91+
script:
92+
- vendor/bin/security-checker security:check
93+
94+
- stage: quality
95+
php: 7.4
96+
env: Codecov
97+
before_script:
98+
- composer update
99+
- php vendor/bin/phpunit
100+
script:
101+
- bash <(curl -s https://codecov.io/bash)
102+
103+
- stage: quality
104+
php: 7.4
105+
env: Psalm
106+
before_script:
107+
- composer update
108+
script:
109+
- vendor/bin/psalm
110+
- vendor/bin/psalter --issues=UnnecessaryVarAnnotation --dry-run
111+
112+
- stage: quality
113+
php: 7.4
114+
env: PHP Codesniffer
115+
before_script:
116+
- composer update
117+
script:
118+
- vendor/bin/phpcs
119+
120+
notifications:
121+
slack:
122+
secure: jgkeIXi7Hzkc907ZKGpuJZ9va+KjHNV0LZoWc22skkDqNIu2wshvqx4wOMFK8CXtRcRgCambtXxyTio17Q4B4mFu1uf7qVN6x18QyLNhfypB/d808kLoJCzlmGB7477jrw5xvgSVOMxWmic8QTjkcMOWSiG4fJE86zIthZP0OOY=

codecov.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
project: yes
4+
patch: off
5+
comment:
6+
layout: "diff"
7+
behavior: once
8+
require_changes: true
9+
require_base: no
10+
require_head: yes
11+
branches: null

composer.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "simplesamlphp/xml-common",
3+
"description": "A library with classes and utilities for handling XML structures.",
4+
"type": "project",
5+
"keywords": [ "saml", "xml" ],
6+
"homepage": "http://simplesamlphp.org",
7+
"license": "LGPL-2.1-or-later",
8+
"authors": [
9+
{
10+
"name": "Jaime Perez",
11+
"email": "[email protected]"
12+
},
13+
{
14+
"name": "Tim van Dijen",
15+
"email": "[email protected]"
16+
}
17+
],
18+
"autoload": {
19+
"psr-4": {
20+
"SimpleSAML\\XML\\": "src/"
21+
}
22+
},
23+
"autoload-dev": {
24+
"psr-4": {
25+
"SimpleSAML\\XML\\Test\\": ["tests", "tests/src"]
26+
}
27+
},
28+
"require": {
29+
"php": ">=7.4 || ^8,0",
30+
"ext-dom": "*"
31+
},
32+
"require-dev": {
33+
"simplesamlphp/simplesamlphp-test-framework": "^0.2.7"
34+
},
35+
"support": {
36+
"issues": "https://github.com/simplesamlphp/xml-tools/issues",
37+
"source": "https://github.com/simplesamlphp/xml-tools"
38+
}
39+
}

phpcs.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="SimpleSAMLphp common XML ruleset">
3+
<config name="ignore_warnings_on_exit" value="1"/>
4+
5+
<description>
6+
By default it is less stringent about long lines than other coding standards
7+
</description>
8+
9+
<file>src</file>
10+
<file>tests</file>
11+
12+
<!-- This is the rule we inherit from. If you want to exlude some specific rules, see the docs on how to do that -->
13+
<rule ref="PSR12"/>
14+
</ruleset>
15+

phpunit.xml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src/</directory>
6+
</include>
7+
<exclude>
8+
<directory>./vendor/</directory>
9+
<directory>./tests/</directory>
10+
</exclude>
11+
<report>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
14+
<text outputFile="php://stdout" showUncoveredFiles="true"/>
15+
</report>
16+
</coverage>
17+
<testsuites>
18+
<testsuite name="Unit tests">
19+
<directory>./vendor/simplesamlphp/simplesamlphp-test-framework/src</directory>
20+
<directory>./tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
<logging/>
24+
</phpunit>

psalm.xml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
name="SimpleSAMLphp"
4+
useDocblockTypes="true"
5+
totallyTyped="false"
6+
hideExternalErrors="true"
7+
allowStringToStandInForClass="true"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<directory name="tests" />
12+
13+
<!-- Ignore certain directories -->
14+
<ignoreFiles>
15+
<directory name="vendor" />
16+
</ignoreFiles>
17+
</projectFiles>
18+
19+
<issueHandlers>
20+
<LessSpecificReturnType errorLevel="info" />
21+
22+
<!-- level 3 issues - slightly lazy code writing, but probably low false-negatives -->
23+
<DeprecatedClass errorLevel="info" />
24+
<DeprecatedMethod errorLevel="info" />
25+
26+
<MissingClosureReturnType errorLevel="info" />
27+
<MissingReturnType errorLevel="info" />
28+
<MissingPropertyType errorLevel="info" />
29+
<InvalidDocblock errorLevel="info" />
30+
<MisplacedRequiredParam errorLevel="info" />
31+
32+
<PropertyNotSetInConstructor errorLevel="info" />
33+
<MissingConstructor errorLevel="info" />
34+
<MissingClosureParamType errorLevel="info" />
35+
<MissingParamType errorLevel="info" />
36+
<UnusedClass errorLevel="info" />
37+
<PossiblyUnusedMethod errorLevel="info" />
38+
39+
<!-- Suppress PHPunit-issue -->
40+
<InternalMethod>
41+
<errorLevel type="suppress">
42+
<directory name="tests" />
43+
</errorLevel>
44+
</InternalMethod>
45+
</issueHandlers>
46+
</psalm>

0 commit comments

Comments
 (0)