Skip to content

Commit 50e3203

Browse files
authored
use promoted properties (#149)
- moved property comments to constructor
1 parent 1036b83 commit 50e3203

9 files changed

+54
-179
lines changed

src/Events/DynamicallyRegisteringFeatureClass.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,14 @@
44

55
class DynamicallyRegisteringFeatureClass
66
{
7-
/**
8-
* The feature class.
9-
*
10-
* @var class-string
11-
*/
12-
public $feature;
137

148
/**
159
* Create a new event instance.
1610
*
17-
* @param class-string $feature
11+
* @param class-string $feature The feature class.
1812
*/
19-
public function __construct($feature)
20-
{
21-
$this->feature = $feature;
13+
public function __construct(
14+
public $feature,
15+
) {
2216
}
2317
}

src/Events/FeatureDeleted.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,15 @@ class FeatureDeleted
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The scope of the feature deletion.
20-
*
21-
* @var mixed
22-
*/
23-
public $scope;
24-
2511
/**
2612
* Create a new event instance.
2713
*
28-
* @param string $feature
29-
* @param mixed $scope
14+
* @param string $feature The feature name.
15+
* @param mixed $scope The scope of the feature deletion.
3016
*/
31-
public function __construct($feature, $scope)
32-
{
33-
$this->feature = $feature;
34-
$this->scope = $scope;
17+
public function __construct(
18+
public $feature,
19+
public $scope,
20+
) {
3521
}
3622
}

src/Events/FeatureResolved.php

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,17 @@ class FeatureResolved
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The scope of the feature check.
20-
*
21-
* @var mixed
22-
*/
23-
public $scope;
24-
25-
/**
26-
* The result value of the feature check.
27-
*
28-
* @var mixed
29-
*/
30-
public $value;
31-
3211
/**
3312
* Create a new event instance.
3413
*
35-
* @param string $feature
36-
* @param mixed $scope
37-
* @param mixed $value
14+
* @param string $feature The feature name.
15+
* @param mixed $scope The scope of the feature check.
16+
* @param mixed $value The result value of the feature check.
3817
*/
39-
public function __construct($feature, $scope, $value)
40-
{
41-
$this->feature = $feature;
42-
$this->scope = $scope;
43-
$this->value = $value;
18+
public function __construct(
19+
public $feature,
20+
public $scope,
21+
public $value,
22+
) {
4423
}
4524
}

src/Events/FeatureRetrieved.php

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,17 @@ class FeatureRetrieved
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The scope of the feature check.
20-
*
21-
* @var mixed
22-
*/
23-
public $scope;
24-
25-
/**
26-
* The result value of the feature check.
27-
*
28-
* @var mixed
29-
*/
30-
public $value;
31-
3211
/**
3312
* Create a new event instance.
3413
*
35-
* @param string $feature
36-
* @param mixed $scope
37-
* @param mixed $value
14+
* @param string $feature The feature name.
15+
* @param mixed $scope The scope of the feature check.
16+
* @param mixed $value The result value of the feature check.
3817
*/
39-
public function __construct($feature, $scope, $value)
40-
{
41-
$this->feature = $feature;
42-
$this->scope = $scope;
43-
$this->value = $value;
18+
public function __construct(
19+
public $feature,
20+
public $scope,
21+
public $value,
22+
) {
4423
}
4524
}

src/Events/FeatureUpdated.php

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,17 @@ class FeatureUpdated
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The scope of the feature update.
20-
*
21-
* @var mixed
22-
*/
23-
public $scope;
24-
25-
/**
26-
* The new feature value.
27-
*
28-
* @var mixed
29-
*/
30-
public $value;
31-
3211
/**
3312
* Create a new event instance.
3413
*
35-
* @param string $feature
36-
* @param mixed $scope
37-
* @param mixed $value
14+
* @param string $feature The feature name.
15+
* @param mixed $scope The scope of the feature update.
16+
* @param mixed $value The new feature value.
3817
*/
39-
public function __construct($feature, $scope, $value)
40-
{
41-
$this->feature = $feature;
42-
$this->scope = $scope;
43-
$this->value = $value;
18+
public function __construct(
19+
public $feature,
20+
public $scope,
21+
public $value,
22+
) {
4423
}
4524
}

src/Events/FeatureUpdatedForAllScopes.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,15 @@ class FeatureUpdatedForAllScopes
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The new feature value.
20-
*
21-
* @var mixed
22-
*/
23-
public $value;
24-
2511
/**
2612
* Create a new event instance.
2713
*
28-
* @param string $feature
29-
* @param mixed $value
14+
* @param string $feature The feature name.
15+
* @param mixed $value The new feature value.
3016
*/
31-
public function __construct($feature, $value)
32-
{
33-
$this->feature = $feature;
34-
$this->value = $value;
17+
public function __construct(
18+
public $feature,
19+
public $value,
20+
) {
3521
}
3622
}

src/Events/FeaturesPurged.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@
44

55
class FeaturesPurged
66
{
7-
/**
8-
* The feature names.
9-
*
10-
* @var array
11-
*/
12-
public $features;
13-
147
/**
158
* Create a new event instance.
169
*
17-
* @param array $features
10+
* @param array $features The feature names.
1811
*/
19-
public function __construct($features)
20-
{
21-
$this->features = $features;
12+
public function __construct(
13+
public $features,
14+
) {
2215
}
2316
}

src/Events/UnexpectedNullScopeEncountered.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@
44

55
class UnexpectedNullScopeEncountered
66
{
7-
/**
8-
* The feature name.
9-
*
10-
* @var string
11-
*/
12-
public $feature;
13-
147
/**
158
* Create a new event instance.
169
*
17-
* @param string $feature
10+
* @param string $feature The feature name.
1811
*/
19-
public function __construct($feature)
20-
{
21-
$this->feature = $feature;
12+
public function __construct(
13+
public $feature,
14+
) {
2215
}
2316
}

src/Events/UnknownFeatureResolved.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,15 @@ class UnknownFeatureResolved
88
{
99
use SerializesModels;
1010

11-
/**
12-
* The feature name.
13-
*
14-
* @var string
15-
*/
16-
public $feature;
17-
18-
/**
19-
* The scope of the feature check.
20-
*
21-
* @var mixed
22-
*/
23-
public $scope;
24-
2511
/**
2612
* Create a new event instance.
2713
*
28-
* @param string $feature
29-
* @param mixed $scope
14+
* @param string $feature The feature name.
15+
* @param mixed $scope The scope of the feature check.
3016
*/
31-
public function __construct($feature, $scope)
32-
{
33-
$this->feature = $feature;
34-
$this->scope = $scope;
17+
public function __construct(
18+
public $feature,
19+
public $scope,
20+
) {
3521
}
3622
}

0 commit comments

Comments
 (0)