Skip to content

[FrameworkBundle] Bug? in generated array shape for 'router' in reference.php #62553

@ThomasLandauer

Description

@ThomasLandauer

Symfony version(s) affected

7.4.0

Description

This is the router array shape in my config/reference.php:

 *     router?: bool|array{ // Router configuration
 *         enabled?: bool, // Default: false
 *         resource: scalar|null,
 *         type?: scalar|null,
 *         cache_dir?: scalar|null, // Deprecated: Setting the "framework.router.cache_dir.cache_dir" configuration option is deprecated. It will be removed in version 8.0. // Default: "%kernel.build_dir%"
 *         default_uri?: scalar|null, // The default URI used to generate URLs in a non-HTTP context. // Default: null
 *         http_port?: scalar|null, // Default: 80
 *         https_port?: scalar|null, // Default: 443
 *         strict_requirements?: scalar|null, // set to true to throw an exception when a parameter does not match the requirements set to false to disable exceptions when a parameter does not match the requirements (and return null instead) set to null to disable parameter checks against requirements 'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production // Default: true
 *         utf8?: bool, // Default: true
 *     },

I think that resource should in fact be resource?, cause it's not mandatory - or is it?
Symfony isn't reporting any error, but PHPStan is reporting:

Type #1 from the union: Array does not have offset 'resource'.

How to reproduce

This is my config/packages/routing.php:

return App::config([
    'framework' => [
        'router' => [
            'utf8' => true,
        ],
    ],
]);

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions