Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Nov 20, 2017
0 parents commit ed2341d
Show file tree
Hide file tree
Showing 37 changed files with 1,706 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.rmt.yml export-ignore
.styleci.yml export-ignore
.travis export-ignore
build.xml export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
tests/ export-ignore
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
phpunit.xml
coverage
composer.lock
vendor
.php_cs.cache
38 changes: 38 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

// try to get Symfony's PHPunit Bridge
$files = array_filter(array(
__DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php',
__DIR__.'/../../../vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php',
), 'file_exists');

if (count($files) > 0) {
require_once current($files);
}

use SLLH\StyleCIBridge\ConfigBridge;

$header = <<<EOF
(c) Christian Gripp <mail@core23.de>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

// PHP-CS-Fixer 1.x
if (class_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer')) {
\Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
}

$config = ConfigBridge::create()
->setUsingCache(true)
;

// PHP-CS-Fixer 2.x
if (method_exists($config, 'setRules')) {
$config->setRules(array_merge($config->getRules(), array(
'header_comment' => array('header' => $header)
)));
}

return $config;
30 changes: 30 additions & 0 deletions .rmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
vcs: git

prerequisites:
- working-copy-check
- display-last-changes
- composer-json-check:
composer: composer
- command:
cmd: composer update
- tests-check:
command: vendor/bin/phpunit --stop-on-failure
- composer-security-check
- composer-stability-check
- command:
cmd: git remote -v

pre-release-actions:
composer-update: ~
changelog-update:
format: simple
dump-commits: true
exclude-merge-commits: true
vcs-commit: ~

version-generator: semantic
version-persister: vcs-tag

post-release-actions:
vcs-publish:
ask-remote-name: true
22 changes: 22 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
preset: symfony

enabled:
- align_double_arrow
- align_equals
- combine_consecutive_unsets
- long_array_syntax
- linebreak_after_opening_tag
- no_php4_constructor
- no_useless_else
- ordered_class_elements
- ordered_imports
- php_unit_construct
- php_unit_strict

disabled:
- unalign_double_arrow
- unalign_equals

finder:
exclude:
- 'tests/Fixtures'
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: php

php:
- 7.1
- nightly

sudo: false

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

env:
global:
- PATH="$HOME/.composer/vendor/bin:$PATH"
- SYMFONY_DEPRECATIONS_HELPER=weak
- TARGET=test

matrix:
fast_finish: true
include:
- php: 7.1
env: TARGET=lint
- php: 7.1
env: TARGET=phpstan
- php: 7.1
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.1
env: SYMFONY_VERSION=2.8.*
- php: 7.1
env: SYMFONY_VERSION=3.2.*
- php: 7.1
env: SYMFONY_VERSION=3.3.*
allow_failures:
- php: nightly
- php: 7.1
env: TARGET=phpstan

install:
- composer global require satooshi/php-coveralls sllh/composer-lint codeclimate/php-test-reporter --prefer-dist --no-interaction
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if [ "$TARGET" == "phpstan" ]; then composer require --dev phpstan/phpstan:^0.8 --no-update; fi
- composer update --prefer-dist --no-interaction $COMPOSER_FLAGS

script: make $TARGET

after_script:
- coveralls -v
- test-reporter
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Christian Gripp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cs:
./vendor/bin/php-cs-fixer fix --verbose

cs_dry_run:
./vendor/bin/php-cs-fixer fix --verbose --dry-run

lint:
composer validate

test:
./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml

phpstan:
./vendor/bin/phpstan analyse -c phpstan.neon -l 4 src tests
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
What is the Doctrine Extensions PHP library?
============================================
[![Latest Stable Version](https://poser.pugx.org/core23/doctrineextensions/v/stable)](https://packagist.org/packages/core23/doctrineextensions)
[![Latest Unstable Version](https://poser.pugx.org/core23/doctrineextensions/v/unstable)](https://packagist.org/packages/core23/doctrineextensions)
[![License](https://poser.pugx.org/core23/doctrineextensions/license)](https://packagist.org/packages/core23/doctrineextensions)

[![Build Status](https://travis-ci.org/core23/doctrineextensions.svg)](http://travis-ci.org/core23/doctrineextensions)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/core23/doctrineextensions/badges/quality-score.png)](https://scrutinizer-ci.com/g/core23/doctrineextensions/)
[![Code Climate](https://codeclimate.com/github/core23/doctrineextensions/badges/gpa.svg)](https://codeclimate.com/github/core23/doctrineextensions)
[![Coverage Status](https://coveralls.io/repos/core23/doctrineextensions/badge.svg)](https://coveralls.io/r/core23/doctrineextensions)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/83024b06-03e0-4b04-a011-8ad598d93af4/mini.png)](https://insight.sensiolabs.com/projects/51aa4b42-d229-4994-bb3a-156da22a1375)

[![Donate to this project using Flattr](https://img.shields.io/badge/flattr-donate-yellow.svg)](https://flattr.com/profile/core23)
[![Donate to this project using PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://paypal.me/gripp)

This library provides adds some useful doctrine hooks and a bridge for symfony.

### Installation

```
php composer.phar require core23/doctrine-extensions
```

### Symfony usage

#### Enabling the bundle

```php
// app/AppKernel.php

public function registerBundles()
{
return array(
// ...

new Core23\DoctrineExtensions\Bridge\Symfony\Bundle\Core23DoctrineExtensionsBundle(),

// ...
);
}
```

This lib / bundle is available under the [MIT license](LICENSE.md).
114 changes: 114 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Core23DoctrineExtensions" basedir="." default="build:main">
<!-- Config files -->
<property name="dir.config" value="${basedir}"/>
<property name="config.phpunit" value="${dir.config}/phpunit.xml.dist"/>
<property name="config.pmd" value="${dir.config}/pmd.xml.dist"/>
<!-- Build paths -->
<property name="dir.build" value="${basedir}/build"/>
<property name="dir.reports" value="${dir.build}/reports"/>
<property name="dir.reports.check" value="${dir.reports}/check"/>
<property name="dir.reports.check.pdepend" value="${dir.reports}/check/pdepend"/>
<property name="dir.reports.test" value="${dir.reports}/test"/>
<property name="dir.reports.test.unit" value="${dir.reports.test}/unit"/>
<property name="dir.reports.test.coverage" value="${dir.reports.test}/coverage"/>
<!-- Source paths -->
<property name="dir.src" value="${basedir}"/>
<!-- BUILD TASKS -->
<!-- Main (default) task -->
<target name="build:main" depends="build:clean, build:prepare, build:check, build:test" description="Run all test and build everything"/>
<!-- Clean previous build files -->
<target name="build:clean" description="Clean previous build files">
<delete dir="${dir.build}" verbose="true"/>
</target>
<!-- Prepare build (performed by each build:* task when called as standalone) -->
<target name="build:prepare" description="Prepare build">
<mkdir dir="${dir.build}"/>
</target>
<!-- Check Project -->
<target name="build:check" description="Check source code" depends="build:prepare, check:prepare, check:cs, check:md, check:cpd, check:pdepend, check:phploc, check:cs-fixer"/>
<!-- Test Project -->
<target name="build:test" description="Perform all tests" depends="build:prepare, test:prepare, test:unit"/>
<!-- CHECK SECTION -->
<!-- Prepare check (performed by each check:* task when called as standalone) -->
<target name="check:prepare" description="Create check directories">
<mkdir dir="${dir.reports.check}"/>
</target>
<!-- CodeSniffer with Symfony2 convention -->
<target name="check:cs" depends="check:prepare" description="Generate PHP_CodeSniffer report">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle"/>
<arg value="--report-file=${dir.reports.check}/checkstyle.xml"/>
<arg value="--report=checkstyle"/>
<arg value="--extensions=php"/>
<arg value="--standard=Symfony2"/>
<arg value="--ignore=vendor"/>
<arg path="${dir.src}"/>
</exec>
</target>
<!-- PHP Copy and Paste Detector -->
<target name="check:cpd" description="Generate phpcpd report" depends="check:prepare">
<exec executable="phpcpd">
<arg value="--log-pmd"/>
<arg path="${dir.reports.check}/cpd.xml"/>
<arg value="--exclude=vendor"/>
<arg path="${dir.src}"/>
</exec>
</target>
<!-- PHP Mess detector -->
<target name="check:md" description="Generate phpmd report" depends="check:prepare">
<exec executable="phpmd">
<arg path="${dir.src}"/>
<arg value="xml"/>
<arg path="${dir.reports.check}/pmd.xml"/>
<arg value="--exclude=vendor"/>
</exec>
</target>
<target name="check:phploc" description="Generate pdepend report" depends="check:prepare">
<exec executable="phploc">
<arg value="--count-tests"/>
<arg value="--log-xml"/>
<arg path="${dir.reports.check}/phploc.xml"/>
<arg value="--exclude=vendor"/>
<arg path="${dir.src}"/>
</exec>
</target>
<target name="check:pdepend" description="Generate pdepend report" depends="check:prepare">
<mkdir dir="${dir.reports.check.pdepend}"/>
<exec executable="pdepend">
<arg value="--jdepend-xml=${dir.reports.check.pdepend}/jdepend.xml"/>
<arg value="--jdepend-chart=${dir.reports.check.pdepend}//dependencies.svg"/>
<arg value="--overview-pyramid=${dir.reports.check.pdepend}/overview-pyramid.svg"/>
<arg value="--ignore=vendor,Tests"/>
<arg path="${dir.src}"/>
</exec>
</target>
<target name="check:cs-fixer" description="Executes php-cs-fixer" depends="check:prepare">
<exec executable="php-cs-fixer">
<arg line="fix"/>
<arg line="--verbose"/>
<arg line="--dry-run"/>
</exec>
</target>
<!-- TEST SECTION -->
<!-- Prepare test environment (performed by each test:* task when called as standalone) -->
<target name="test:prepare" description="Prepare the test environment">
<mkdir dir="${dir.reports.test}"/>
<exec executable="composer">
<arg value="update"/>
</exec>
</target>
<!-- Prepare unit test environment -->
<target name="test:unit:prepare" description="Prepare the unit test environment" depends="test:prepare">
<mkdir dir="${dir.reports.test.unit}"/>
</target>
<!-- Execute unit tests and code coverage -->
<target name="test:unit" description="Perform unit tests and code coverage" depends="test:prepare, test:unit:prepare">
<exec executable="phpunit">
<arg line="--log-junit ${dir.reports.test.unit}/phpunit.xml"/>
<arg line="--coverage-clover ${dir.reports.test.coverage}/clover.xml"/>
<arg line="--coverage-html ${dir.reports.test.coverage}/html"/>
<arg line="-c ${config.phpunit}"/>
</exec>
</target>
</project>

0 comments on commit ed2341d

Please sign in to comment.