Skip to content

[PHPUnitBridge] Static access in closure #29724

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 2 commits into from
Jan 27, 2019

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Dec 29, 2018

Q A
Branch? master for features
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n / a
License MIT
Doc PR n / a

#29718 bumps php to 5.5 . This is what we could simplify if it gets merged, thanks to this "new" PHP feature: https://3v4l.org/sJOWr

EDIT: it was merged, this can be reviewed.

@greg0ire
Copy link
Contributor Author

Doing many commits for now, in case some of them cannot be merged. Will squash if everything is all good.

@greg0ire greg0ire force-pushed the static_access_in_closure branch 2 times, most recently from 8df51b1 to e90bfef Compare December 30, 2018 09:18
@greg0ire
Copy link
Contributor Author

Prepended the commit list with one cs-fix commit (self accessor), apparently the code wasn't even valid before any changes. Got rid of the fabbot commit by dispatching changes to the right commits.

@greg0ire greg0ire force-pushed the static_access_in_closure branch from e90bfef to 5345897 Compare December 30, 2018 09:35
@greg0ire
Copy link
Contributor Author

The Travis failure seems unrelated.

@greg0ire greg0ire changed the title Static access in closure [PHPUnitBridge] Static access in closure Dec 30, 2018
@greg0ire greg0ire force-pushed the static_access_in_closure branch from 5345897 to 2584634 Compare January 1, 2019 18:18
@nicolas-grekas nicolas-grekas added this to the next milestone Jan 3, 2019
@greg0ire greg0ire force-pushed the static_access_in_closure branch 2 times, most recently from 17417bb to b7100b3 Compare January 3, 2019 15:29
@greg0ire
Copy link
Contributor Author

greg0ire commented Jan 3, 2019

The build failures are unrelated, please review again @nicolas-grekas

@greg0ire greg0ire force-pushed the static_access_in_closure branch 2 times, most recently from 1a12b1c to 79921b3 Compare January 14, 2019 19:49
@nicolas-grekas
Copy link
Member

rebase needed please, but before, I'd recommend you to squash+apply move to short arrays.

@greg0ire greg0ire force-pushed the static_access_in_closure branch from 79921b3 to 7bee301 Compare January 25, 2019 13:34
@@ -43,234 +57,55 @@ public static function register($mode = 0)
return;
}

$UtilPrefix = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_' : 'PHPUnit\Util\\';
self::computeMode($mode);
Copy link
Member

Choose a reason for hiding this comment

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

Computing the mode should be kept lazy: it allows registering the bridge and configure the mode a bit later before any deprecation is thrown. That's an important behavior we should keep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I introduced a new $rawMode static to keep the value until it is necessary to compute the actual mode.

@greg0ire greg0ire force-pushed the static_access_in_closure branch from 7bee301 to 9df76eb Compare January 27, 2019 17:08
@nicolas-grekas
Copy link
Member

I pushed a 2nd commit here, that uses an internal instance instead of static properties to track the state.
I also gave up preserving original ordering :)

@nicolas-grekas nicolas-grekas force-pushed the static_access_in_closure branch from 29f3e54 to 97f3023 Compare January 27, 2019 18:05
@nicolas-grekas
Copy link
Member

Thank you @greg0ire.

@nicolas-grekas nicolas-grekas merged commit 97f3023 into symfony:master Jan 27, 2019
nicolas-grekas added a commit that referenced this pull request Jan 27, 2019
…las-grekas)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[PHPUnitBridge] Static access in closure

| Q             | A
| ------------- | ---
| Branch?       | master for features
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n / a
| License       | MIT
| Doc PR        | n / a

#29718 bumps php to 5.5 . This is what we could simplify if it gets merged, thanks to this "new" PHP feature: https://3v4l.org/sJOWr

EDIT: it was merged, this can be reviewed.

Commits
-------

97f3023 Use the scope of an instance
9df76eb Extract closures into static functions
@greg0ire greg0ire deleted the static_access_in_closure branch January 27, 2019 18:13
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants