Skip to content

Commit ea29f16

Browse files
authored
Add Coding standards check for Github Actions (#2222)
* Add Coding standards check for Github Actions * Fix @var * Upgrade to php-cs-fixer 3.0 * Apply php-cs-fixer
1 parent cd96b9f commit ea29f16

File tree

159 files changed

+467
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+467
-438
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Coding Standards"
2+
3+
on:
4+
pull_request: null
5+
6+
jobs:
7+
coding-standards:
8+
name: "Coding Standards"
9+
runs-on: "ubuntu-20.04"
10+
11+
steps:
12+
- name: "Checkout"
13+
uses: "actions/checkout@v2"
14+
15+
- name: "Install PHP"
16+
uses: "shivammathur/setup-php@v2"
17+
with:
18+
coverage: "none"
19+
php-version: "7.4"
20+
21+
- name: "Install dependencies with Composer"
22+
uses: "ramsey/composer-install@v1"
23+
with:
24+
dependency-versions: "highest"
25+
26+
- name: "Run PHP-CS-Fixer"
27+
run: "bin/php-cs-fixer fix --ansi --verbose --diff --dry-run"
28+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
bin
33
vendor
44

5-
.php_cs.cache
5+
.php-cs-fixer.cache
66
composer.lock
77
tests/phpunit.xml
88
tests/temp/*.php

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
__DIR__ . '/tests',
88
]);
99

10-
return PhpCsFixer\Config::create()
10+
$config = new PhpCsFixer\Config();
11+
return $config
1112
->setRules([
1213
'@PSR2' => true,
1314
'@Symfony' => true,
1415
'array_syntax' => ['syntax' => 'short'],
1516
'ordered_imports' => ['sort_algorithm' => 'alpha'],
1617
'phpdoc_summary' => false,
18+
'phpdoc_to_comment' => false,
1719
])
1820
->setFinder($finder);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"doctrine/doctrine-bundle": "^2.3",
5151
"doctrine/mongodb-odm": "^2.0",
5252
"doctrine/orm": "^2.6.3",
53-
"friendsofphp/php-cs-fixer": "^2.16",
53+
"friendsofphp/php-cs-fixer": "^3.0",
5454
"phpunit/phpunit": "^8.5",
5555
"symfony/cache": "^4.4 || ^5.0",
5656
"symfony/yaml": "^4.1"

example/em.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'driver' => 'pdo_mysql',
1515
];
1616
if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
17-
die('cannot find vendors, read README.md how to use composer');
17+
exit('cannot find vendors, read README.md how to use composer');
1818
}
1919
// First of all autoloading of vendors
2020
$loader = require __DIR__.'/../vendor/autoload.php';

src/Blameable/Mapping/Driver/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Annotation extends AbstractAnnotationDriver
1919
/**
2020
* Annotation field is blameable
2121
*/
22-
const BLAMEABLE = 'Gedmo\\Mapping\\Annotation\\Blameable';
22+
public const BLAMEABLE = 'Gedmo\\Mapping\\Annotation\\Blameable';
2323

2424
/**
2525
* List of types which are valid for blame

src/DoctrineExtensions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Gedmo;
44

5+
use function class_exists;
56
use Doctrine\Common\Annotations\AnnotationReader;
67
use Doctrine\Common\Annotations\AnnotationRegistry;
78
use Doctrine\Common\Annotations\PsrCachedReader;
@@ -12,7 +13,6 @@
1213
use Doctrine\ORM\Mapping\Driver as DriverORM;
1314
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
1415
use Symfony\Component\Cache\Adapter\ArrayAdapter;
15-
use function class_exists;
1616

1717
/**
1818
* Version class allows to checking the dependencies required
@@ -26,7 +26,7 @@ final class DoctrineExtensions
2626
/**
2727
* Current version of extensions
2828
*/
29-
const VERSION = '3.1.0';
29+
public const VERSION = '3.1.0';
3030

3131
/**
3232
* Hooks all extensions metadata mapping drivers

src/IpTraceable/Mapping/Driver/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Annotation extends AbstractAnnotationDriver
1919
/**
2020
* Annotation field is ipTraceable
2121
*/
22-
const IP_TRACEABLE = 'Gedmo\\Mapping\\Annotation\\IpTraceable';
22+
public const IP_TRACEABLE = 'Gedmo\\Mapping\\Annotation\\IpTraceable';
2323

2424
/**
2525
* List of types which are valid for IP

src/Loggable/LoggableListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ class LoggableListener extends MappedEventSubscriber
1919
/**
2020
* Create action
2121
*/
22-
const ACTION_CREATE = 'create';
22+
public const ACTION_CREATE = 'create';
2323

2424
/**
2525
* Update action
2626
*/
27-
const ACTION_UPDATE = 'update';
27+
public const ACTION_UPDATE = 'update';
2828

2929
/**
3030
* Remove action
3131
*/
32-
const ACTION_REMOVE = 'remove';
32+
public const ACTION_REMOVE = 'remove';
3333

3434
/**
3535
* Username for identification

src/Loggable/Mapping/Driver/Annotation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class Annotation extends AbstractAnnotationDriver
2121
/**
2222
* Annotation to define that this object is loggable
2323
*/
24-
const LOGGABLE = 'Gedmo\\Mapping\\Annotation\\Loggable';
24+
public const LOGGABLE = 'Gedmo\\Mapping\\Annotation\\Loggable';
2525

2626
/**
2727
* Annotation to define that this property is versioned
2828
*/
29-
const VERSIONED = 'Gedmo\\Mapping\\Annotation\\Versioned';
29+
public const VERSIONED = 'Gedmo\\Mapping\\Annotation\\Versioned';
3030

3131
/**
3232
* {@inheritdoc}

0 commit comments

Comments
 (0)