Skip to content

Commit d8ea83f

Browse files
committed
Init
0 parents  commit d8ea83f

File tree

12 files changed

+688
-0
lines changed

12 files changed

+688
-0
lines changed

.cs.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
return PhpCsFixer\Config::create()
4+
->setUsingCache(false)
5+
->setRiskyAllowed(true)
6+
//->setCacheFile(__DIR__ . '/.php_cs.cache')
7+
->setRules([
8+
'@PSR1' => true,
9+
'@PSR2' => true,
10+
'@Symfony' => true,
11+
'psr4' => true,
12+
// custom rules
13+
'align_multiline_comment' => true, // psr-5
14+
'array_indentation' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'cast_spaces' => ['space' => 'none'],
17+
'concat_space' => ['spacing' => 'one'],
18+
'compact_nullable_typehint' => true,
19+
'declare_equal_normalize' => ['space' => 'single'],
20+
'general_phpdoc_annotation_remove' => [
21+
'annotations' => [
22+
'author',
23+
'package',
24+
],
25+
],
26+
'increment_style' => ['style' => 'post'],
27+
'list_syntax' => ['syntax' => 'short'],
28+
'no_short_echo_tag' => true,
29+
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
30+
'phpdoc_align' => false,
31+
'phpdoc_no_empty_return' => false,
32+
'phpdoc_order' => true, // psr-5
33+
'protected_to_private' => false,
34+
'yoda_style' => false,
35+
])
36+
->setFinder(PhpCsFixer\Finder::create()
37+
->in(__DIR__ . '/src')
38+
->in(__DIR__ . '/tests')
39+
->name('*.php')
40+
->ignoreDotFiles(true)
41+
->ignoreVCS(true));

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
public/* linguist-vendored
5+
docs/* linguist-documentation
6+
7+
# Set the default behavior, in case people don't have core.autocrlf set.
8+
# Git will always convert line endings to LF on checkout. You should use
9+
# this for files that must keep LF endings, even on Windows.
10+
* text eol=lf
11+
12+
# Define binary file attributes.
13+
# - Do not treat them as text.
14+
# - Include binary diff in patches instead of "binary files differ."
15+
*.gif binary
16+
*.ico binary
17+
*.jpg binary
18+
*.png binary
19+
*.phar binary
20+
*.zip binary
21+
*.gz binary
22+
*.otf binary
23+
*.eot binary
24+
*.svg binary
25+
*.ttf binary
26+
*.woff binary
27+
*.woff2 binary

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.idea/
2+
nbproject/
3+
composer.phar
4+
composer.lock
5+
.DS_STORE
6+
cache.properties
7+
.php_cs.cache
8+
.vscode
9+
10+
.env
11+
public/.env
12+
13+
env.php
14+
config/env.php
15+
16+
vendor/
17+
build/
18+
19+
!public/cache/
20+
public/cache/*
21+
!public/cache/.htaccess
22+
23+
!tmp/
24+
tmp/*
25+
!tmp/.htaccess
26+
27+
!tmp/log/
28+
tmp/log/*
29+
!tmp/log/empty
30+
31+
!tmp/logs/
32+
tmp/logs/*
33+
!tmp/logs/empty
34+
35+
!tmp/assets-cache/
36+
tmp/assets-cache/*
37+
!tmp/assets-cache/empty
38+
39+
!tmp/locale-cache/
40+
tmp/locale-cache/*
41+
!tmp/locale-cache/empty
42+
43+
!tmp/routes-cache/
44+
tmp/routes-cache/*
45+
!tmp/routes-cache/empty
46+
47+
!tmp/twig-cache/
48+
tmp/twig-cache/*
49+
!tmp/twig-cache/empty
50+
51+

.scrutinizer.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
filter:
2+
paths: ["src/*"]
3+
excluded_paths: ["vendor/*", "tests/*", "resources/", "public/"]
4+
5+
checks:
6+
php:
7+
code_rating: true
8+
duplication: true
9+
10+
tools:
11+
external_code_coverage: false
12+
13+
build:
14+
environment:
15+
php: 7.2
16+
mysql: true
17+
node: false
18+
postgresql: false
19+
mongodb: false
20+
elasticsearch: false
21+
redis: false
22+
memcached: false
23+
neo4j: false
24+
rabbitmq: false
25+
dependencies:
26+
before:
27+
- php cli.php install --environment travis
28+
tests:
29+
before:
30+
-
31+
command: 'vendor/bin/phpunit --coverage-clover build/logs/clover.xml'
32+
coverage:
33+
file: 'build/logs/clover.xml'
34+
format: 'clover'

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
7+
# This triggers builds to run on the new TravisCI infrastructure.
8+
# See: https://docs.travis-ci.com/user/getting-started/#Selecting-infrastructure-(optional)
9+
sudo: false
10+
11+
# Cache composer
12+
cache:
13+
directories:
14+
- $HOME/.composer/cache
15+
16+
before_script:
17+
- travis_retry composer self-update
18+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
19+
- php cli.php install --environment travis
20+
- cd $TRAVIS_BUILD_DIR
21+
22+
script:
23+
- ant check-style
24+
- ant phpstan
25+
- ant phpunit-coverage

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 odan
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
10+
furnished 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 THE
21+
SOFTWARE.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Validation
2+
3+
[![Latest Version on Packagist](https://img.shields.io/github/release/odan/validation.svg)](https://github.com/odan/validation/releases)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
5+
[![Build Status](https://travis-ci.org/odan/validation.svg?branch=master)](https://travis-ci.org/odan/validation)
6+
[![Quality Score](https://scrutinizer-ci.com/g/odan/validation/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/odan/validation/?branch=master)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/odan/validation.svg)](https://packagist.org/packages/odan/validation)
8+
9+
10+
## Requirements
11+
12+
* PHP 7.1+
13+
14+
## Installation
15+
16+
```shell
17+
composer require odan/validation
18+
```
19+
20+
## Documentation
21+
22+
This package is documented [here](./docs/readme.md).
23+
24+
## License
25+
26+
The MIT License (MIT). Please see [License File](LICENSE) for more information.
27+
28+
29+
[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
30+
[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
31+
[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
32+
[Composer]: http://getcomposer.org/
33+
[PHPUnit]: http://phpunit.de/

build.xml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="app" basedir=".">
3+
4+
<condition property="ext" value=".bat">
5+
<os family="windows"/>
6+
</condition>
7+
8+
<condition property="ext" value=".bat" else="">
9+
<os family="windows"/>
10+
</condition>
11+
12+
<target name="phpunit" description="Run PHPUnit">
13+
<exec executable="${basedir}/vendor/bin/phpunit${ext}" searchpath="true" resolveexecutable="true" failonerror="true" taskname="phpunit">
14+
<arg value="--configuration"/>
15+
<arg path="${basedir}/phpunit.xml"/>
16+
</exec>
17+
</target>
18+
19+
<target name="phpunit-coverage" description="Run unit tests with PHPUnit with coverage">
20+
<delete dir="${basedir}/build/coverage"/>
21+
<mkdir dir="${basedir}/build/coverage"/>
22+
<exec executable="${basedir}/vendor/bin/phpunit${ext}" searchpath="true" resolveexecutable="true"
23+
failonerror="true" taskname="phpunit-coverage">
24+
<arg value="--coverage-text"/>
25+
<arg value="--configuration"/>
26+
<arg path="${basedir}/phpunit.xml"/>
27+
<arg value="--coverage-clover"/>
28+
<arg path="${basedir}/build/logs/clover.xml"/>
29+
<arg value="--coverage-html"/>
30+
<arg path="${basedir}/build/coverage"/>
31+
</exec>
32+
</target>
33+
34+
<target name="fix-style" description="Code style fixer">
35+
<mkdir dir="${basedir}/build"/>
36+
<get src="http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar" dest="${basedir}/build/php-cs-fixer.phar" skipexisting="true"/>
37+
<exec executable="php" searchpath="true" resolveexecutable="true" failonerror="true">
38+
<arg value="${basedir}/build/php-cs-fixer.phar"/>
39+
<arg line="fix --config=.cs.php"/>
40+
</exec>
41+
</target>
42+
43+
<target name="check-style" description="Code style check">
44+
<mkdir dir="${basedir}/build"/>
45+
<get src="http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar" dest="${basedir}/build/php-cs-fixer.phar" skipexisting="true"/>
46+
<exec executable="php" searchpath="true" resolveexecutable="true" failonerror="true">
47+
<arg value="${basedir}/build/php-cs-fixer.phar"/>
48+
<arg line="fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php"/>
49+
</exec>
50+
</target>
51+
52+
<target name="phpstan" description="PHP Static Analysis Tool - discover bugs in your code without running it">
53+
<mkdir dir="${basedir}/build"/>
54+
<get src="https://github.com/phpstan/phpstan/releases/download/0.9.2/phpstan.phar"
55+
dest="${basedir}/build/phpstan.phar" skipexisting="true"/>
56+
<exec executable="php" searchpath="true" resolveexecutable="true" failonerror="true">
57+
<arg value="${basedir}/build/phpstan.phar"/>
58+
<arg value="analyse"/>
59+
<arg value="-l"/>
60+
<arg value="5"/>
61+
<arg value="src"/>
62+
<arg value="tests"/>
63+
<arg value="--no-interaction"/>
64+
<arg value="--no-progress"/>
65+
</exec>
66+
</target>
67+
68+
<target name="check-travis" depends="check-style,phpstan"/>
69+
70+
</project>

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "odan/validation",
3+
"description": "Validation classes",
4+
"minimum-stability": "stable",
5+
"type": "library",
6+
"keywords": [
7+
"validation"
8+
],
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Odan",
13+
"homepage": "https://odan.github.io/",
14+
"role": "Developer"
15+
}
16+
],
17+
"require": {
18+
"php": ">=7.1"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^6.0|^7.0"
22+
},
23+
"autoload": {
24+
"psr-4": {
25+
"Odan\\Validation\\": "src/Validation/"
26+
}
27+
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"Odan\\Validation\\Test\\": "tests/"
31+
}
32+
},
33+
"config": {
34+
"sort-packages": true
35+
}
36+
}

phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="TestSuite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>

0 commit comments

Comments
 (0)