8000 Fix an issue with numeric data provider keys and run tests with format clear for both PHPUnit >= 10 and PHPUnit < 10 by sidz · Pull Request #1900 · infection/infection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix an issue with numeric data provider keys and run tests with format clear for both PHPUnit >= 10 and PHPUnit < 10 #1900

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

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

sidz
Copy link
Member
@sidz sidz commented Dec 4, 2023

This PR:

@maks-rafalko maks-rafalko enabled auto-merge (squash) December 4, 2023 23:10

$methodNameWithDataProviderResult = sprintf('%s with data set "%s"', $methodName, $dataProviderKey);
if (preg_match('/#(\d+)/', $dataProviderKey)) {
Copy link
Member
@sanmai sanmai Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (preg_match('/#(\d+)/', $dataProviderKey)) {
if (preg_match('/#(\d+)$/', $dataProviderKey)) {

How can we be sure we are not catching digits in the middle of the string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^#(\d+)$ will do the trick

@sidz sidz force-pushed the fix-phpunit-10-filter-compatibility branch 2 times, most recently from ff6091a to f573156 Compare December 6, 2023 20:12
…t clear for both PHPUnit >= 10 and PHPUnit < 10
@sidz sidz force-pushed the fix-phpunit-10-filter-compatibility branch from f573156 to a2ad0be Compare December 6, 2023 20:15
@sidz
Copy link
Member Author
sidz commented Dec 6, 2023

I think the issue with E2E is not related to my changes.

cc @theofidry

@maks-rafalko maks-rafalko merged commit 6a46a15 into master Dec 6, 2023
@maks-rafalko maks-rafalko deleted the fix-phpunit-10-filter-compatibility branch December 6, 2023 21:39
@maks-rafalko
Copy link
Member < 8000 /div>
maks-rafalko commented Dec 6, 2023

seems like rerunning has fixed it (PR has been automatically merged), however fails on master. Let's see...

Thank you for fixing it, @sidz!

@maks-rafalko
Copy link
Member

no, it fails. Created #1901


$methodNameWithDataProviderResult = sprintf('%s with data set "%s"', $methodName, $dataProviderKey);
if (preg_match('/^(\d+)$/', $dataProviderKey) === 0) {
Copy link
Contributor
@MidnightDesign MidnightDesign Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't is_numeric() way faster than a regular expression? Also, the parentheses are redundant, aren't they?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we go: #1904

Copy link
Member Author
@sidz sidz Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @MidnightDesign. I choose preg_match as initially thought that numeric string looks like ##123. But after that I just forgot to replace this part of code.

Thanks for highlighting this

github-merge-queue bot referenced this pull request in Lendable/clock Dec 9, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [infection/infection](https://togithub.com/infection/infection) |
`^0.27.8` -> `^0.27.9` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/infection%2finfection/0.27.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/infection%2finfection/0.27.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/infection%2finfection/0.27.8/0.27.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/infection%2finfection/0.27.8/0.27.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) |
`^3.40.2` -> `^3.41.0` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.41.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.41.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.40.2/3.41.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.40.2/3.41.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `^1.10.47`
-> `^1.10.48` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.48?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.48?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.47/1.10.48?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.47/1.10.48?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>infection/infection (infection/infection)</summary>

###
[`v0.27.9`](https://togithub.com/infection/infection/releases/tag/0.27.9):
Fix an issue with numeric data provider keys in PHPUnit &gt;&#x3D; 10

[Compare
Source](https://togithub.com/infection/infection/compare/0.27.8...0.27.9)

**Fixed:**

- Fix an issue with numeric data provider keys and run tests with format
clear for both PHPUnit >= 10 and PHPUnit < 10 by
[@&#8203;sidz](https://togithub.com/sidz) in
[https://github.com/infection/infection/pull/1900](https://togithub.com/infection/infection/pull/1900)
- Disable Box Requirements Checker as it conflicts with
symfony/service-contracts package by
[@&#8203;sidz](https://togithub.com/sidz) in
[https://github.com/infection/infection/pull/1902](https://togithub.com/infection/infection/pull/1902)
- build: Disable the requirement checker by
[@&#8203;theofidry](https://togithub.com/theofidry) in
[https://github.com/infection/infection/pull/1903](https://togithub.com/infection/infection/pull/1903)

**Full Changelog**:
infection/infection@0.27.8...0.27.9

</details>

<details>
<summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary>

###
[`v3.41.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.40.2...v3.41.0)

[Compare
Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.40.2...v3.41.0)

</details>

<details>
<summary>phpstan/phpstan (phpstan/phpstan)</summary>

###
[`v1.10.48`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.48)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.47...1.10.48)

# Bleeding edge 🔪

- TooWideMethodReturnTypehintRule - always report for final methods
(phpstan/phpstan-src@c30e9a4)
- LogicalXorConstantConditionRule
(phpstan/phpstan-src@3a12724,
phpstan/phpstan-src@3b011f6),
[#&#8203;7539](https://togithub.com/phpstan/phpstan/issues/7539)
- NoopRule - report top-level `xor` because that's probably not what the
user intended to do
(phpstan/phpstan-src@a1fffb3),
[#&#8203;10267](https://togithub.com/phpstan/phpstan/issues/10267)
- Report unused results of `and` and `or`
(phpstan/phpstan-src@1d8fff6)
- Report unused result of ternary
(phpstan/phpstan-src@9664f7a)
- Report unused results of `&&` and `||`
(phpstan/phpstan-src@cf2c8bb)

*If you want to see the shape of things to come and adopt bleeding edge
features early, you can include this config file in your project's
`phpstan.neon`:*

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon

*Of course, there are no backwards compatibility guarantees when you
include this file. The behaviour and reported errors can change in minor
versions with this file included. [Learn
more](https://phpstan.org/blog/what-is-bleeding-edge)*

# Improvements 🔧

- Narrow `ReflectionEnum::getName()` after `ReflectionEnum::isBacked()`
([#&#8203;2806](https://togithub.com/phpstan/phpstan-src/pull/2806)),
[#&#8203;10192](https://togithub.com/phpstan/phpstan/issues/10192),
thanks [@&#8203;franmomu](https://togithub.com/franmomu)!
- Any variable can exist after include/require
(phpstan/phpstan-src@0a3a968),
[https://github.com/phpstan/phpstan/discussions/10252](https://togithub.com/phpstan/phpstan/discussions/10252)

# Bugfixes 🐛

- ResolvedPhpDocBlock: fix parent return tag merging
([#&#8203;2803](https://togithub.com/phpstan/phpstan-src/pull/2803)),
[#&#8203;6462](https://togithub.com/phpstan/phpstan/issues/6462),
[#&#8203;10208](https://togithub.com/phpstan/phpstan/issues/10208),
[#&#8203;3580](https://togithub.com/phpstan/phpstan/issues/3580),
[#&#8203;4396](https://togithub.com/phpstan/phpstan/issues/4396), thanks
[@&#8203;janedbal](https://togithub.com/janedbal)!
- Merge in-foreach scope even for non-iterable expr
(phpstan/phpstan-src@942afbf)
- TooWideMethodReturnTypehintRule - never report in a trait
(phpstan/phpstan-src@e0eb850)
- Narrowing list type with `count()` results in type loss
([#&#8203;2811](https://togithub.com/phpstan/phpstan-src/pull/2811)),
[#&#8203;10264](https://togithub.com/phpstan/phpstan/issues/10264),
thanks [@&#8203;staabm](https://togithub.com/staabm)!
- Fix LevelsTestCase for PHPUnit 10
(phpstan/phpstan-src@fa5d5f9)

# Function signature fixes 🤖

- Update return type information for `SimpleXMLElement::addChild`
([#&#8203;2808](https://togithub.com/phpstan/phpstan-src/pull/2808)),
[#&#8203;10269](https://togithub.com/phpstan/phpstan/issues/10269),
thanks [@&#8203;DaveLiddament](https://togithub.com/DaveLiddament)!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Lendable/clock).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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 this pull request may close these issues.

4 participants
0