Skip to content

Commit a516630

Browse files
committed
coding style: fixes in code
1 parent 6303c62 commit a516630

10 files changed

+25
-25
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static function isIdentifier($value): bool
231231

232232
public static function isNamespaceIdentifier($value, bool $allowLeadingSlash = false): bool
233233
{
234-
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . Helpers::PHP_IDENT . '(\\\\' . Helpers::PHP_IDENT . ')*\z#';
234+
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*\z#';
235235
return is_string($value) && preg_match($re, $value);
236236
}
237237

tests/PhpGenerator/ClassType.from.anonymous.phpt

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

1616
abstract class Class1
1717
{
18-
function func1()
18+
public function func1()
1919
{
2020
}
2121
}
@@ -26,7 +26,7 @@ $res[] = ClassType::from(new class {
2626
private $b;
2727

2828

29-
function a()
29+
public function a()
3030
{
3131
}
3232

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

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

tests/PhpGenerator/ClassType.from.php71.phpt

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

2323

24-
function func2(): ?stdClass
24+
public function func2(): ?stdClass
2525
{
2626
}
2727

2828

29-
function func3(): void
29+
public function func3(): void
3030
{
3131
}
3232
}

tests/PhpGenerator/ClassType.from.phpt

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

2828
interface Interface2
@@ -32,7 +32,7 @@ interface Interface2
3232
abstract class Class1 implements Interface1
3333
{
3434
/** @return Class1 */
35-
function func1()
35+
public function func1()
3636
{
3737
}
3838

@@ -65,7 +65,7 @@ class Class2 extends Class1 implements Interface2
6565
}
6666

6767

68-
final function func2()
68+
final public function func2()
6969
{
7070
}
7171
}

tests/PhpGenerator/ClassType.inheritance.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class A
1616
private $c;
1717

1818

19-
function foo()
19+
public function foo()
2020
{
2121
}
2222
}
@@ -29,7 +29,7 @@ class B extends A
2929
private $f;
3030

3131

32-
function bar()
32+
public function bar()
3333
{
3434
return 3;
3535
}

tests/PhpGenerator/GlobalFunction.phpt

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

1717

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

tests/PhpGenerator/Helpers.comments.phpt

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

2121
Assert::same('', Helpers::unformatDocComment(''));
2222
Assert::same('', Helpers::unformatDocComment("/** */\n\r\t"));
23-
Assert::same('@var string', Helpers::unformatDocComment(" /** @var string */ "));
23+
Assert::same('@var string', Helpers::unformatDocComment(' /** @var string */ '));
2424
Assert::same('@var string', Helpers::unformatDocComment("/**\n * @var string\n */"));
2525
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
@@ -35,7 +35,7 @@ Assert::same("'He\\llo'", Helpers::dump('He\llo'));
3535
Assert::same('\'He\ll\\\\\o \\\'wor\\\\\\\'ld\\\\\'', Helpers::dump('He\ll\\\o \'wor\\\'ld\\'));
3636
Assert::same('[]', Helpers::dump([]));
3737

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

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

6060
class Test2 extends Test
6161
{
62-
private $c = 4;
6362
public $d = 5;
63+
private $c = 4;
6464

6565

66-
function __sleep()
66+
public function __sleep()
6767
{
6868
return ['c', 'b', 'a'];
6969
}
7070

7171

72-
function __wakeup()
72+
public function __wakeup()
7373
{
7474
}
7575
}
@@ -83,13 +83,13 @@ class Test3 implements Serializable
8383
private $a;
8484

8585

86-
function serialize()
86+
public function serialize()
8787
{
8888
return '';
8989
}
9090

9191

92-
function unserialize($s)
92+
public function unserialize($s)
9393
{
9494
}
9595
}

tests/PhpGenerator/Method.returnTypes.phpt

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

2626
interface A
2727
{
28-
function testClass(): \A\Foo;
28+
public function testClass(): \A\Foo;
2929

30-
function testScalar(): string;
30+
public function testScalar(): string;
3131
}
3232

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

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

3939
// generating methods with return type declarations

tests/PhpGenerator/Method.variadics.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface Variadics
2222
function bar($foo, array &...$bar);
2323
}
2424

25-
$method = Method::from(Variadics::class .'::foo');
25+
$method = Method::from(Variadics::class . '::foo');
2626
Assert::true($method->isVariadic());
2727

2828
$method = Method::from(Variadics::class . '::bar');

0 commit comments

Comments
 (0)