Skip to content

Commit

Permalink
[ADD] PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Th3Mouk committed Oct 21, 2015
1 parent 86c5d0c commit 77477d5
Show file tree
Hide file tree
Showing 32 changed files with 529 additions and 288 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
vendor
tests/SimpleThings/Tests/EntityAudit/cache
.php_cs.cache
45 changes: 45 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

$header = <<<EOF
(c) 2011 SimpleThings GmbH
@package SimpleThings\EntityAudit
@author Benjamin Eberlei <[email protected]>
@link http://www.simplethings.de
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
EOF;

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(array(__DIR__))
->exclude(array('Tests/Fixtures'))
;

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers(array(
'header_comment',
'newline_after_open_tag',
'ordered_use',
'long_array_syntax',
'php_unit_construct',
))
->setUsingCache(true)
->finder($finder)
;
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cs:
./vendor/bin/php-cs-fixer fix --verbose

cs_dry_run:
./vendor/bin/php-cs-fixer fix --verbose --dry-run
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,7 @@ This provides you with a few different routes:
* Proper metadata mapping is necessary, allow to disable versioning for fields and associations.
* It does NOT work with Joined-Table-Inheritance (Single Table Inheritance should work, but not tested)
* Many-To-Many associations are NOT versioned

## Contributing

Before each commit please run the `make cs` command.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"require-dev": {
"symfony/framework-bundle": "~2.3",
"phpunit/phpunit": "~4.0",
"gedmo/doctrine-extensions": "~2.2"
"gedmo/doctrine-extensions": "~2.2",
"fabpot/php-cs-fixer": "^1.0"
},
"autoload": {
"psr-4": {"SimpleThings\\EntityAudit\\": "src/SimpleThings/EntityAudit"}
Expand All @@ -21,4 +22,3 @@
}
}
}

1 change: 1 addition & 0 deletions src/SimpleThings/EntityAudit/AuditConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* (c) 2011 SimpleThings GmbH
*
Expand Down
24 changes: 23 additions & 1 deletion src/SimpleThings/EntityAudit/AuditManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<?php

/*
* (c) 2011 SimpleThings GmbH
*
* @package SimpleThings\EntityAudit
* @author Benjamin Eberlei <[email protected]>
* @link http://www.simplethings.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

namespace SimpleThings\EntityAudit;

use Doctrine\Common\EventManager;
Expand Down Expand Up @@ -46,4 +68,4 @@ public function registerEvents(EventManager $evm)
$evm->addEventSubscriber(new CreateSchemaListener($this));
$evm->addEventSubscriber(new LogRevisionsListener($this));
}
}
}
Loading

0 comments on commit 77477d5

Please sign in to comment.