Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Commit

Permalink
removed static to function
Browse files Browse the repository at this point in the history
added narrowspark/coding-standard
  • Loading branch information
prisis committed Sep 16, 2018
1 parent 78388ad commit 38355e9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 17 deletions.
13 changes: 13 additions & 0 deletions .changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);

use ChangelogGenerator\ChangelogConfig;

return [
(new ChangelogConfig(
'narrowspark',
'automatic',
'v2.0.1',
['Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security']
))
];
12 changes: 7 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
*.php text eol=lf

tests/ export-ignore
build export-ignore
src/ export-ignore
build/ export-ignore
.github export-ignore

.php_cs export-ignore
.changelog export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
codecov.yml export-ignore
cerebro export-ignore
CONTRIBUTING.md export-ignore
phpstan.neon export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
README.md export-ignore
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
"symfony/polyfill-mbstring": "^1.8.0"
},
"require-dev": {
"narrowspark/php-cs-fixer-config": "^3.0.1",
"phpstan/phpstan": "^0.9.0",
"phpstan/phpstan-phpunit": "^0.9.0",
"phpstan/phpstan-strict-rules": "^0.9.0",
"phpunit/phpunit": "^7.0.0"
"phpunit/phpunit": "^7.2.0",
"narrowspark/coding-standard": "^1.2.1"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -53,6 +50,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"changelog": "changelog-generator generate --config=\".changelog\" --file --prepend",
"coverage": "phpunit --coverage-html=\"build/logs\"",
"cs": "php-cs-fixer fix",
"phpstan": "phpstan analyse -c phpstan.neon -l 7 src --memory-limit=-1",
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
includes:
# - vendor/pepakriz/phpstan-exception-rules/extension.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

parameters:
autoload_directories:
Expand Down
12 changes: 6 additions & 6 deletions src/PrettyArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function setResolver(string $type, \Closure $closure): void
/**
* Returns a pretty php array for saving or output.
*
* @param array $data
* @param int $indentLevel
* @param mixed[] $data
* @param int $indentLevel
*
* @return string
*/
Expand All @@ -62,7 +62,7 @@ public function print(array $data, int $indentLevel = 1): string

foreach ($data as $key => $value) {
if (! \is_int($key)) {
if (self::isClass($key)) {
if ($this->isClass($key)) {
$key = $this->resolverCallbacks['class']($key);
} else {
$key = \sprintf("'%s'", $key);
Expand All @@ -73,7 +73,7 @@ public function print(array $data, int $indentLevel = 1): string
'%s%s%s,',
$indent,
\sprintf('%s => ', $key),
self::createValue($value, $indentLevel)
$this->createValue($value, $indentLevel)
);
}

Expand All @@ -98,7 +98,7 @@ private function createValue($value, int $indentLevel): string
return $this->print($value, $indentLevel + 1);
}

if (self::isClass($value)) {
if ($this->isClass($value)) {
return $this->resolverCallbacks['class']($value);
}

Expand All @@ -116,7 +116,7 @@ private function createValue($value, int $indentLevel): string
*
* @return bool
*/
private static function isClass($key): bool
private function isClass($key): bool
{
if (! \is_string($key)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion tests/PrettyArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ public function testConvertsValueToValidPhp($array, $expected, int $indentLevel
}
}

$this->assertEquals($expected, $prettyArray->print($array, $indentLevel));
static::assertEquals($expected, $prettyArray->print($array, $indentLevel));
}
}

0 comments on commit 38355e9

Please sign in to comment.