Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent using integers or numeric strings as keys #4

Open
4 tasks done
tangrufus opened this issue Mar 11, 2020 · 1 comment · May be fixed by #10
Open
4 tasks done

Prevent using integers or numeric strings as keys #4

tangrufus opened this issue Mar 11, 2020 · 1 comment · May be fixed by #10

Comments

@tangrufus
Copy link
Collaborator

tangrufus commented Mar 11, 2020

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
@tangrufus tangrufus changed the title Prevent using integers as key Prevent using integers or numberic strings as keys Mar 11, 2020
@tangrufus tangrufus changed the title Prevent using integers or numberic strings as keys Prevent using integers or numeric strings as keys Mar 11, 2020
@austinpray
Copy link
Collaborator

@tangrufus I'm down for doing all this

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

Let's do it and tag a 2.0?

tangrufus added a commit to tangrufus/wp-config that referenced this issue Mar 13, 2020
- Bump minimum PHP requirement from 5.6 to 7.0
- Add PHP 7.3 and 7.4 to test matrix
- Update dependencies

See: roots#4
tangrufus added a commit to tangrufus/wp-config that referenced this issue Mar 13, 2020
- Bump minimum PHP requirement from 5.6 to 7.1 (inline with [Bedrock](https://github.com/roots/bedrock/blob/ff5e28ac74f1e9aac1b44f8d197054a34eb85079/composer.json#L33))
- Add PHP 7.3 and 7.4 to test matrix
- Update dependencies

See: roots#4
austinpray pushed a commit that referenced this issue Mar 13, 2020
- Bump minimum PHP requirement from 5.6 to 7.1 (inline with [Bedrock](https://github.com/roots/bedrock/blob/ff5e28ac74f1e9aac1b44f8d197054a34eb85079/composer.json#L33))
- Add PHP 7.3 and 7.4 to test matrix
- Update dependencies

See: #4
tangrufus added a commit to tangrufus/wp-config that referenced this issue Mar 13, 2020
@tangrufus tangrufus linked a pull request Mar 13, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants