12
12
namespace Symfony \Cmf \Bundle \RoutingBundle \Model ;
13
13
14
14
use Symfony \Cmf \Component \Routing \RouteObjectInterface ;
15
+ use Symfony \Component \Routing \CompiledRoute ;
15
16
use Symfony \Component \Routing \Route as SymfonyRoute ;
16
17
use Symfony \Component \Routing \RouteCompiler ;
17
18
@@ -147,7 +148,7 @@ public function getContent()
147
148
*
148
149
* Prevent setting the default 'compiler_class' so that we do not persist it
149
150
*/
150
- public function setOptions (array $ options )
151
+ public function setOptions (array $ options ): static
151
152
{
152
153
return $ this ->addOptions ($ options );
153
154
}
@@ -159,7 +160,7 @@ public function setOptions(array $options)
159
160
*
160
161
* @see setOptions
161
162
*/
162
- public function getOption ($ name )
163
+ public function getOption (string $ name ): mixed
163
164
{
164
165
$ option = parent ::getOption ($ name );
165
166
if (null === $ option && 'compiler_class ' === $ name ) {
@@ -179,7 +180,7 @@ public function getOption($name)
179
180
*
180
181
* @see setOptions
181
182
*/
182
- public function getOptions ()
183
+ public function getOptions (): array
183
184
{
184
185
$ options = parent ::getOptions ();
185
186
if (!\array_key_exists ('compiler_class ' , $ options )) {
@@ -209,7 +210,7 @@ protected function isBooleanOption($name)
209
210
/**
210
211
* {@inheritdoc}
211
212
*/
212
- public function getPath ()
213
+ public function getPath (): string
213
214
{
214
215
$ pattern = '' ;
215
216
if ($ this ->getOption ('add_locale_pattern ' )) {
@@ -234,7 +235,7 @@ public function getPath()
234
235
* When using PHPCR-ODM, make sure to persist the route before calling this
235
236
* to have the id field initialized.
236
237
*/
237
- public function setPath ($ pattern )
238
+ public function setPath (string $ pattern ): static
238
239
{
239
240
if (0 !== strpos ($ pattern , $ this ->getStaticPrefix ())) {
240
241
throw new \InvalidArgumentException (sprintf (
@@ -273,7 +274,7 @@ public function setVariablePattern($variablePattern)
273
274
*
274
275
* Overwritten to make sure the route is recompiled if the pattern was changed
275
276
*/
276
- public function compile ()
277
+ public function compile (): CompiledRoute
277
278
{
278
279
if ($ this ->needRecompile ) {
279
280
// calling parent::setPath just to let it set compiled=null. the parent $path field is never used
0 commit comments