Skip to content

Commit 7452b02

Browse files
committed
feature: review source models
1 parent 041d482 commit 7452b02

File tree

2 files changed

+12
-51
lines changed

2 files changed

+12
-51
lines changed

Model/FileSource.php

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,29 @@
2222

2323
class FileSource implements SourceInterface
2424
{
25-
/**
26-
* @var string
27-
*/
28-
private $path;
29-
30-
/**
31-
* @var int
32-
*/
33-
private $line;
34-
35-
/**
36-
* @var int
37-
*/
38-
private $column;
39-
40-
/**
41-
* @param string $path
42-
* @param int|null $line
43-
* @param int|null $column
44-
*/
45-
public function __construct($path, $line = null, $column = null)
46-
{
47-
$this->path = $path;
48-
$this->line = $line;
49-
$this->column = $column;
25+
public function __construct(
26+
private string $path,
27+
private int|null $line = null,
28+
private int|null $column = null,
29+
) {
5030
}
5131

52-
/**
53-
* @return string
54-
*/
55-
public function getPath()
32+
public function getPath(): string
5633
{
5734
return $this->path;
5835
}
5936

60-
/**
61-
* @return int|null
62-
*/
63-
public function getLine()
37+
public function getLine(): int|null
6438
{
6539
return $this->line;
6640
}
6741

68-
/**
69-
* @return int|null
70-
*/
71-
public function getColumn()
42+
public function getColumn(): int|null
7243
{
7344
return $this->column;
7445
}
7546

76-
/**
77-
* @param SourceInterface $source
78-
*
79-
* @return bool
80-
*/
81-
public function equals(SourceInterface $source)
47+
public function equals(SourceInterface $source): bool
8248
{
8349
if (!$source instanceof FileSource) {
8450
return false;
@@ -95,10 +61,7 @@ public function equals(SourceInterface $source)
9561
return $this->column === $source->getColumn();
9662
}
9763

98-
/**
99-
* @return string
100-
*/
101-
public function __toString()
64+
public function __toString(): string
10265
{
10366
$str = $this->path;
10467

Model/SourceInterface.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
namespace JMS\TranslationBundle\Model;
2222

23-
interface SourceInterface
23+
interface SourceInterface extends \Stringable
2424
{
25-
public function equals(SourceInterface $source);
26-
27-
public function __toString();
25+
public function equals(SourceInterface $source): bool;
2826
}

0 commit comments

Comments
 (0)