Skip to content

Commit d6e76b8

Browse files
committed
coding style: fixes in code
1 parent b1c0643 commit d6e76b8

11 files changed

+28
-28
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static function isIdentifier($value)
246246
*/
247247
public static function isNamespaceIdentifier($value, $allowLeadingSlash = false)
248248
{
249-
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . Helpers::PHP_IDENT . '(\\\\' . Helpers::PHP_IDENT . ')*\z#';
249+
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*\z#';
250250
return is_string($value) && preg_match($re, $value);
251251
}
252252

src/PhpGenerator/Parameter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class Parameter
1818
use Nette\SmartObject;
1919
use Traits\NameAware;
2020

21+
/** @var mixed */
22+
public $defaultValue;
23+
2124
/** @var bool */
2225
private $reference = false;
2326

@@ -30,9 +33,6 @@ class Parameter
3033
/** @var bool */
3134
private $hasDefaultValue = false;
3235

33-
/** @var mixed */
34-
public $defaultValue;
35-
3636

3737
/**
3838
* @deprecated

tests/PhpGenerator/ClassType.from.php7.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
1414

1515
abstract class Class1
1616
{
17-
function func1()
17+
public function func1()
1818
{
1919
}
2020
}
@@ -25,7 +25,7 @@ $res[] = ClassType::from(new class {
2525
private $b;
2626

2727

28-
function a()
28+
public function a()
2929
{
3030
}
3131

@@ -36,7 +36,7 @@ $res[] = ClassType::from(new class {
3636
});
3737

3838
$res[] = ClassType::from(new class extends Class1 {
39-
function a()
39+
public function a()
4040
{
4141
}
4242
});

tests/PhpGenerator/ClassType.from.php71.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ require __DIR__ . '/../bootstrap.php';
1414
/** */
1515
class ClassA
1616
{
17-
function func1(A $a, ?B $b, ?C $c = null, D $d = null, E $e, ?int $i = 1, ?array $arr = [])
17+
public function func1(A $a, ?B $b, ?C $c = null, D $d = null, E $e, ?int $i = 1, ?array $arr = [])
1818
{
1919
}
2020

2121

22-
function func2(): ?stdClass
22+
public function func2(): ?stdClass
2323
{
2424
}
2525

2626

27-
function func3(): void
27+
public function func3(): void
2828
{
2929
}
3030
}

tests/PhpGenerator/ClassType.from.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require __DIR__ . '/../bootstrap.php';
1919
*/
2020
interface Interface1
2121
{
22-
function func1();
22+
public function func1();
2323
}
2424

2525
interface Interface2
@@ -29,7 +29,7 @@ interface Interface2
2929
abstract class Class1 implements Interface1
3030
{
3131
/** @return Class1 */
32-
function func1()
32+
public function func1()
3333
{
3434
}
3535

@@ -62,7 +62,7 @@ class Class2 extends Class1 implements Interface2
6262
}
6363

6464

65-
final function func2()
65+
final public function func2()
6666
{
6767
}
6868
}

tests/PhpGenerator/ClassType.inheritance.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class A
1414
private $c;
1515

1616

17-
function foo()
17+
public function foo()
1818
{
1919
}
2020
}
@@ -27,7 +27,7 @@ class B extends A
2727
private $f;
2828

2929

30-
function bar()
30+
public function bar()
3131
{
3232
return 3;
3333
}

tests/PhpGenerator/GlobalFunction.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require __DIR__ . '/../bootstrap.php';
1010
/** global */
1111
function func(stdClass $a, $b = null)
1212
{
13-
};
13+
}
1414

1515

1616
$function = GlobalFunction::from('func');

tests/PhpGenerator/Helpers.comments.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Assert::same("/**\n * A\n * B\n * C\n */\n", Helpers::formatDocComment("A\nB\nC\
1818

1919
Assert::same('', Helpers::unformatDocComment(''));
2020
Assert::same('', Helpers::unformatDocComment("/** */\n\r\t"));
21-
Assert::same('@var string', Helpers::unformatDocComment(" /** @var string */ "));
21+
Assert::same('@var string', Helpers::unformatDocComment(' /** @var string */ '));
2222
Assert::same('@var string', Helpers::unformatDocComment("/**\n * @var string\n */"));
2323
Assert::same("A\nB\nC", Helpers::unformatDocComment("/**\n * A\n * B\n * C\n */\n"));

tests/PhpGenerator/Helpers.dump().phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Assert::same("'He\\llo'", Helpers::dump('He\llo'));
3333
Assert::same('\'He\ll\\\\\o \\\'wor\\\\\\\'ld\\\\\'', Helpers::dump('He\ll\\\o \'wor\\\'ld\\'));
3434
Assert::same('[]', Helpers::dump([]));
3535

36-
Assert::same("[\$s]", Helpers::dump([new PhpLiteral('$s')]));
36+
Assert::same('[$s]', Helpers::dump([new PhpLiteral('$s')]));
3737

3838
Assert::same('[1, 2, 3]', Helpers::dump([1, 2, 3]));
3939
Assert::same("['a', 7 => 'b', 'c', '9a' => 'd', 'e']", Helpers::dump(['a', 7 => 'b', 'c', '9a' => 'd', 9 => 'e']));
@@ -57,17 +57,17 @@ Assert::equal(new Test, eval('return ' . Helpers::dump(new Test) . ';'));
5757

5858
class Test2 extends Test
5959
{
60-
private $c = 4;
6160
public $d = 5;
61+
private $c = 4;
6262

6363

64-
function __sleep()
64+
public function __sleep()
6565
{
6666
return ['c', 'b', 'a'];
6767
}
6868

6969

70-
function __wakeup()
70+
public function __wakeup()
7171
{
7272
}
7373
}
@@ -81,13 +81,13 @@ class Test3 implements Serializable
8181
private $a;
8282

8383

84-
function serialize()
84+
public function serialize()
8585
{
8686
return '';
8787
}
8888

8989

90-
function unserialize($s)
90+
public function unserialize($s)
9191
{
9292
}
9393
}

tests/PhpGenerator/Method.returnTypes.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ namespace
2424

2525
interface A
2626
{
27-
function testClass(): \A\Foo;
27+
public function testClass(): \A\Foo;
2828

29-
function testScalar(): string;
29+
public function testScalar(): string;
3030
}
3131

32-
$method = Method::from(A::class .'::testClass');
32+
$method = Method::from(A::class . '::testClass');
3333
Assert::same('A\Foo', $method->getReturnType());
3434

35-
$method = Method::from(A::class .'::testScalar');
35+
$method = Method::from(A::class . '::testScalar');
3636
Assert::same('string', $method->getReturnType());
3737

3838
// generating methods with return type declarations

0 commit comments

Comments
 (0)