Skip to content

Commit 332f65e

Browse files
committed
Remove PHP 7.1 only code
and add license credit to phpcs-calisthenics-rules
1 parent d8780e3 commit 332f65e

8 files changed

+62
-22
lines changed

Inpsyde/Helpers.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard;
@@ -14,7 +19,7 @@
1419

1520
/**
1621
* @package php-coding-standards
17-
* @license MIT
22+
* @license http://opensource.org/licenses/MIT MIT
1823
*/
1924
class Helpers
2025
{

Inpsyde/Sniffs/CodeQuality/ElementNameMinimalLengthSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -16,7 +21,7 @@
1621

1722
/**
1823
* @package php-coding-standards
19-
* @license MIT
24+
* @license http://opensource.org/licenses/MIT MIT
2025
*/
2126
final class ElementNameMinimalLengthSniff implements Sniff
2227
{
@@ -43,7 +48,7 @@ public function register(): array
4348
* @param File $file
4449
* @param int $position
4550
*/
46-
public function process(File $file, $position): void
51+
public function process(File $file, $position)
4752
{
4853
$elementName = Helpers::tokenName($file, $position);
4954
$elementNameLength = mb_strlen($elementName);

Inpsyde/Sniffs/CodeQuality/ForbiddenPublicPropertySniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -17,7 +22,7 @@
1722

1823
/**
1924
* @package php-coding-standards
20-
* @license MIT
25+
* @license http://opensource.org/licenses/MIT MIT
2126
*/
2227
final class ForbiddenPublicPropertySniff implements Sniff
2328
{
@@ -33,7 +38,7 @@ public function register(): array
3338
* @param File $file
3439
* @param int $position
3540
*/
36-
public function process(File $file, $position): void
41+
public function process(File $file, $position)
3742
{
3843
if (!Helpers::isProperty($file, $position)) {
3944
return;

Inpsyde/Sniffs/CodeQuality/FunctionLengthSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -15,7 +20,7 @@
1520

1621
/**
1722
* @package php-coding-standards
18-
* @license MIT
23+
* @license http://opensource.org/licenses/MIT MIT
1924
*/
2025
final class FunctionLengthSniff implements Sniff
2126
{
@@ -36,7 +41,7 @@ public function register(): array
3641
* @param File $file
3742
* @param int $position
3843
*/
39-
public function process(File $file, $position): void
44+
public function process(File $file, $position)
4045
{
4146
$length = $this->getStructureLengthInLines($file, $position);
4247

Inpsyde/Sniffs/CodeQuality/MaxNestingLevelSniff.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -15,7 +20,7 @@
1520

1621
/**
1722
* @package php-coding-standards
18-
* @license MIT
23+
* @license http://opensource.org/licenses/MIT MIT
1924
*/
2025
final class MaxNestingLevelSniff implements Sniff
2126
{
@@ -66,7 +71,7 @@ public function register(): array
6671
* @param File $file
6772
* @param int $position
6873
*/
69-
public function process(File $file, $position): void
74+
public function process(File $file, $position)
7075
{
7176
$this->file = $file;
7277
$this->position = $position;
@@ -88,7 +93,7 @@ public function process(File $file, $position): void
8893
$this->handleNestingLevel($this->nestingLevel);
8994
}
9095

91-
private function handleNestingLevel(int $nestingLevel): void
96+
private function handleNestingLevel(int $nestingLevel)
9297
{
9398
if ($nestingLevel > $this->maxNestingLevel) {
9499
$levelPluralization = $this->maxNestingLevel > 1 ? 's' : '';
@@ -107,7 +112,7 @@ private function handleNestingLevel(int $nestingLevel): void
107112
/**
108113
* @param mixed[] $tokens
109114
*/
110-
private function iterateTokens(int $start, int $end, array $tokens): void
115+
private function iterateTokens(int $start, int $end, array $tokens)
111116
{
112117
$this->currentPtr = $start + 1;
113118

@@ -122,7 +127,7 @@ private function iterateTokens(int $start, int $end, array $tokens): void
122127
/**
123128
* @param mixed[] $nestedToken
124129
*/
125-
private function handleToken(array $nestedToken): void
130+
private function handleToken(array $nestedToken)
126131
{
127132
$this->handleClosureToken($nestedToken);
128133
$this->handleCaseToken($nestedToken);
@@ -149,7 +154,7 @@ private function subtractFunctionNestingLevel(array $token): int
149154
/**
150155
* @param mixed[] $nestedToken
151156
*/
152-
private function handleClosureToken(array $nestedToken): void
157+
private function handleClosureToken(array $nestedToken)
153158
{
154159
if ($nestedToken['code'] === T_CLOSURE) {
155160
// Move index pointer in case we found a lambda function
@@ -163,7 +168,7 @@ private function handleClosureToken(array $nestedToken): void
163168
/**
164169
* @param mixed[] $nestedToken
165170
*/
166-
private function handleCaseToken(array $nestedToken): void
171+
private function handleCaseToken(array $nestedToken)
167172
{
168173
if (in_array($nestedToken['code'], [T_CASE, T_DEFAULT])) {
169174
array_push($this->ignoredScopeStack, $nestedToken);
@@ -172,7 +177,7 @@ private function handleCaseToken(array $nestedToken): void
172177
}
173178
}
174179

175-
private function adjustNestingLevelToIgnoredScope(): void
180+
private function adjustNestingLevelToIgnoredScope()
176181
{
177182
// Iterated through ignored scope stack to find out if
178183
// anything can be popped out and adjust nesting level.
@@ -185,7 +190,7 @@ private function adjustNestingLevelToIgnoredScope(): void
185190
* @param int $key
186191
* @param mixed[] $ignoredScope
187192
*/
188-
private function unsetScopeIfNotCurrent(int $key, array $ignoredScope): void
193+
private function unsetScopeIfNotCurrent(int $key, array $ignoredScope)
189194
{
190195
if ($ignoredScope['scope_closer'] !== $this->currentPtr) {
191196
return;

Inpsyde/Sniffs/CodeQuality/NoElseSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -15,7 +20,7 @@
1520

1621
/**
1722
* @package php-coding-standards
18-
* @license MIT
23+
* @license http://opensource.org/licenses/MIT MIT
1924
*/
2025
final class NoElseSniff implements Sniff
2126
{
@@ -36,7 +41,7 @@ public function register(): array
3641
* @param File $file
3742
* @param int $position
3843
*/
39-
public function process(File $file, $position): void
44+
public function process(File $file, $position)
4045
{
4146
$file->addWarning(self::ERROR_MESSAGE, $position, 'NoElse');
4247
}

Inpsyde/Sniffs/CodeQuality/NoSetterSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -15,7 +20,7 @@
1520

1621
/**
1722
* @package php-coding-standards
18-
* @license MIT
23+
* @license http://opensource.org/licenses/MIT MIT
1924
*/
2025
final class NoSetterSniff implements Sniff
2126
{
@@ -32,7 +37,7 @@ public function register(): array
3237
* @param int $position
3338
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException
3439
*/
35-
public function process(File $file, $position): void
40+
public function process(File $file, $position)
3641
{
3742
$declarationName = $file->getDeclarationName($position);
3843
if ($declarationName === null) {

Inpsyde/Sniffs/CodeQuality/PropertyPerClassLimitSniff.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
9+
*
10+
* This file contains code from "phpcs-calisthenics-rules" repository
11+
* found at https://github.com/object-calisthenics
12+
* Copyright (c) 2014 Doctrine Project
13+
* released under MIT license.
914
*/
1015

1116
namespace Inpsyde\CodingStandard\Sniffs\CodeQuality;
@@ -16,7 +21,7 @@
1621

1722
/**
1823
* @package php-coding-standards
19-
* @license MIT
24+
* @license http://opensource.org/licenses/MIT MIT
2025
*/
2126
final class PropertyPerClassLimitSniff implements Sniff
2227
{
@@ -37,7 +42,7 @@ public function register(): array
3742
* @param File $file
3843
* @param int $position
3944
*/
40-
public function process(File $file, $position): void
45+
public function process(File $file, $position)
4146
{
4247
$count = count(Helpers::classPropertiesTokenIndexes($file, $position));
4348

0 commit comments

Comments
 (0)