Skip to content

Commit 5a3358f

Browse files
alexanderzaiets-payserapelanis
authored andcommitted
review concerns fix
1 parent 1295616 commit 5a3358f

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ namespace Some\Namespace;
562562

563563
// ...
564564

565-
public function setSomething(\Vendor\Namespace\Entity\Value $value);
565+
public function setSomething(\Vendor\Namespace\Entity\Value $value): self;
566566
```
567567

568568
Right:
@@ -574,7 +574,7 @@ namespace Some\Namespace;
574574

575575
use Vendor\Namespace\Entity\Value;
576576

577-
public function setSomething(Value $value);
577+
public function setSomething(Value $value): self;
578578
```
579579

580580
## Usage of PHP features
@@ -746,7 +746,7 @@ Wrong:
746746
```php
747747
<?php
748748

749-
function getSomething(): string
749+
function getSomething(): ?string
750750
{
751751
$a = get();
752752
return $a;
@@ -758,7 +758,7 @@ Correct:
758758
```php
759759
<?php
760760

761-
function getSomething(): string
761+
function getSomething(): ?string
762762
{
763763
return get();
764764
}
@@ -1025,6 +1025,8 @@ function getValue(MyObject $object): string
10251025
return $object->get();
10261026
}
10271027
/**
1028+
* @param int $requestId
1029+
* @return bool
10281030
* @throws PaybackUnavailableException
10291031
*/
10301032
function payback(int $requestId): bool
@@ -1053,9 +1055,10 @@ function getValue(MyObject $object): ?string
10531055
return $object->get();
10541056
}
10551057
/**
1058+
* @param int $requestId
10561059
* @throws PaybackUnavailableException
10571060
*/
1058-
function payback($requestId): void
1061+
function payback(int $requestId): void
10591062
{
10601063
makePayback($requestId);
10611064
}
@@ -1116,10 +1119,7 @@ declare(strict_types=1);
11161119

11171120
class SomeClass
11181121
{
1119-
/**
1120-
* @var Child|null
1121-
*/
1122-
private $child;
1122+
private ?Child $child;
11231123

11241124
public function getChild(): Child
11251125
{
@@ -1688,24 +1688,24 @@ any of parameters in the code itself.
16881688
For example, instead of:
16891689

16901690
```php
1691-
class ServiceA
1691+
class ServiceAlpha
16921692
{
16931693
public function doSomething(): void
16941694
{
16951695
$alpha = Manager::getInstance();
16961696
$alpha->doSomething('a');
16971697
}
16981698
}
1699-
class ServiceB
1699+
class ServiceBeta
17001700
{
17011701
public function doSomething(): void
17021702
{
17031703
$alpha = Manager::getInstance();
17041704
$alpha->doSomething('b');
17051705
}
17061706
}
1707-
$alpha = new ServiceA();
1708-
$beta = new ServiceB();
1707+
$alpha = new ServiceAlpha();
1708+
$beta = new ServiceBeta();
17091709
```
17101710

17111711
we use:
@@ -3328,6 +3328,14 @@ class UserData
33283328
private string $email;
33293329
private string $name;
33303330
3331+
public function __construct(
3332+
string $email,
3333+
string $name
3334+
) {
3335+
$this->email = $email;
3336+
$this->name = $name;
3337+
}
3338+
33313339
public function getEmail(): string
33323340
{
33333341
return $this->email;

0 commit comments

Comments
 (0)