Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prevent using integers or numeric strings as keys #4

@tangrufus

Description

@tangrufus

Description

Unexpected behaviors when using integers or numeric strings as keys

Steps to reproduce

// Without declare(strict_types=1); !!
Config::define(999, 'nine nine nine');
Config::apply();

Expected behavior:

Warn (or throw exceptions) about using integers or numeric strings as keys is incorrect.

Actual behavior:

echo Config::get(999);
==> nine nine nine

echo constant(999);
==> nine nine nine

echo constant('999');
==> nine nine nine

echo 999;
==> 999

Possible Solution

  • Bump PHP requirement
  • Add declare(strict_types=1);
  • Add type hints

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