@@ -47,30 +47,24 @@ short example containing most features described below::
47
47
*/
48
48
class FooBar
49
49
{
50
- const SOME_CONST = 42;
50
+ public const SOME_CONST = 42;
51
51
52
- /**
53
- * @var string
54
- */
55
- private $fooBar;
56
-
57
- private $qux;
52
+ private string $fooBar;
53
+ private Qux $qux;
58
54
59
55
/**
60
- * @param string $dummy Some argument description
56
+ * @param $dummy some argument description
61
57
*/
62
- public function __construct($dummy, Qux $qux)
58
+ public function __construct(string $dummy, Qux $qux)
63
59
{
64
60
$this->fooBar = $this->transformText($dummy);
65
61
$this->qux = $qux;
66
62
}
67
63
68
64
/**
69
- * @return string
70
- *
71
65
* @deprecated
72
66
*/
73
- public function someDeprecatedMethod()
67
+ public function someDeprecatedMethod(): string
74
68
{
75
69
trigger_deprecation('symfony/package-name', '5.1', 'The %s() method is deprecated, use Acme\Baz::someMethod() instead.', __METHOD__);
76
70
@@ -80,14 +74,11 @@ short example containing most features described below::
80
74
/**
81
75
* Transforms the input given as the first argument.
82
76
*
83
- * @param bool|string $dummy Some argument description
84
- * @param array $options An options collection to be used within the transformation
85
- *
86
- * @return string|null The transformed input
77
+ * @param $options an options collection to be used within the transformation
87
78
*
88
- * @throws \RuntimeException When an invalid option is provided
79
+ * @throws \RuntimeException when an invalid option is provided
89
80
*/
90
- private function transformText($dummy, array $options = [])
81
+ private function transformText(bool|string $dummy, array $options = []): ?string
91
82
{
92
83
$defaultOptions = [
93
84
'some_default' => 'values',
@@ -100,16 +91,13 @@ short example containing most features described below::
100
91
}
101
92
}
102
93
103
- $mergedOptions = array_merge(
104
- $defaultOptions,
105
- $options
106
- );
94
+ $mergedOptions = array_merge($defaultOptions, $options);
107
95
108
96
if (true === $dummy) {
109
97
return 'something';
110
98
}
111
99
112
- if (is_string($dummy)) {
100
+ if (\ is_string($dummy)) {
113
101
if ('values' === $mergedOptions['some_default']) {
114
102
return substr($dummy, 0, 5);
115
103
}
@@ -122,11 +110,8 @@ short example containing most features described below::
122
110
123
111
/**
124
112
* Performs some basic operations for a given value.
125
- *
126
- * @param mixed $value Some value to operate against
127
- * @param bool $theSwitch Some switch to control the method's flow
128
113
*/
129
- private function performOperations($value = null, $theSwitch = false)
114
+ private function performOperations(mixed $value = null, bool $theSwitch = false)
130
115
{
131
116
if (!$theSwitch) {
132
117
return;
0 commit comments