Skip to content

Commit 8e94772

Browse files
authored
Merge pull request #8 from adriansuter/patch-phpcs
Add phpcs
2 parents 87d6b04 + 6b9658e commit 8e94772

36 files changed

+133
-70
lines changed

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"autoload-dev": {
2727
"psr-4": {
2828
"My\\Integration\\": "tests/integration/src",
29-
"AdrianSuter\\Autoload\\Override\\": "tests/integration/src-override"
29+
"AdrianSuter\\Autoload\\Override\\": "tests/integration/src-override",
30+
"AdrianSuter\\Autoload\\Override\\Tests\\": "tests"
3031
},
3132
"classmap": [
3233
"tests/integration/src/TestClassMapOverride"
@@ -37,12 +38,15 @@
3738
"nikic/php-parser": "^4.3"
3839
},
3940
"require-dev": {
40-
"phpunit/phpunit": "^7.0"
41+
"phpunit/phpunit": "^7.0",
42+
"squizlabs/php_codesniffer": "^3.5"
4143
},
4244
"scripts": {
4345
"test": [
44-
"@phpunit"
46+
"@phpunit",
47+
"@phpcs"
4548
],
46-
"phpunit": "phpunit"
49+
"phpunit": "phpunit",
50+
"phpcs": "phpcs"
4751
}
4852
}

phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHP Autoload Override coding standard">
3+
<description>PHP Autoload Override coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<!-- use colors in output -->
8+
<arg name="colors"/>
9+
10+
<!-- inherit rules from: -->
11+
<rule ref="PSR12"/>
12+
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
13+
14+
<!-- Paths to check -->
15+
<file>src</file>
16+
<file>tests</file>
17+
</ruleset>

src/AutoloadCollection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*

src/ClosureHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*

src/CodeConverter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*
@@ -75,10 +76,10 @@ public function __construct(
7576
?NodeFinder $nodeFinder = null
7677
) {
7778
$this->lexer = $lexer ?? new Emulative(
78-
[
79+
[
7980
'usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos'],
8081
]
81-
);
82+
);
8283

8384
$this->parser = $parser ?? new Php7($this->lexer);
8485

src/FileStreamWrapper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*
@@ -42,6 +43,7 @@
4243
use function touch;
4344
use function unlink;
4445

46+
// phpcs:disable PSR1.Methods.CamelCapsMethodName
4547
class FileStreamWrapper
4648
{
4749
/**

src/Override.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*

tests/AbstractIntegrationTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*
@@ -7,6 +8,8 @@
78

89
declare(strict_types=1);
910

11+
namespace AdrianSuter\Autoload\Override\Tests;
12+
1013
use AdrianSuter\Autoload\Override\Override;
1114
use PHPUnit\Framework\TestCase;
1215

@@ -24,7 +27,6 @@ public static function setUpBeforeClass()
2427
protected function setUp()
2528
{
2629
parent::setUp();
27-
2830
if (!$this->overrideApplied) {
2931
$this->overrideApplied = true;
3032
Override::apply(self::$classLoader, $this->getOverrideDeclarations());

tests/AutoloadCollectionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*
@@ -7,6 +8,8 @@
78

89
declare(strict_types=1);
910

11+
namespace AdrianSuter\Autoload\Override\Tests;
12+
1013
use AdrianSuter\Autoload\Override\AutoloadCollection;
1114
use PHPUnit\Framework\TestCase;
1215

tests/ClosureHandlerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* PHP Autoload Override (https://github.com/adriansuter/php-autoload-override)
45
*
@@ -7,8 +8,11 @@
78

89
declare(strict_types=1);
910

11+
namespace AdrianSuter\Autoload\Override\Tests;
12+
1013
use AdrianSuter\Autoload\Override\ClosureHandler;
1114
use PHPUnit\Framework\TestCase;
15+
use RuntimeException;
1216

1317
final class ClosureHandlerTest extends TestCase
1418
{

0 commit comments

Comments
 (0)