Skip to content

PHPstan complaining about optional Parameters for ObjectDriver #218

@tassilogroeper

Description

@tassilogroeper

Related to the PR #212 we introduced the possibility to set src/Drivers/ObjectDriver.php with

  'yaml_inline' => 2,
  'yaml_indent' => 4,
  'yaml_flags' => Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK,

However the DocBlock annotations should consider setting not all but only one key. Instead of:

    /**
     * @param array{
     *     yaml_inline: int,
     *     yaml_indent: int,
     *     yaml_flags: int
     * } $yamlConfig
     */

do

    /**
     * @param array{
     *     yaml_inline?: int,
     *     yaml_indent?: int,
     *     yaml_flags?: int
     * } $yamlConfig
     */

Otherwise static analysis like PHPStan will complain that keys are missing from the first parameter of the ObjectDriver contructor.

Sorry, had not thought of that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions