question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update PHP-Scoper to v0.16.2

See original GitHub issue

Task Description

The current version of PHP-Scoper is 0.16.2.

In version 0.16.0, there were lots of improvements to the config, making it a lot simpler for us to configure PHP-Scoper in a WP plugin context.

It means we can get rid of all the manual str_replace calls in the scoper config thanks to expose-global-{constants, classes, functions} and expose-{namespaces, constants, classes, functions}

We could even automate this by setting the config based on the WP stubs, see https://github.com/humbug/php-scoper/issues/303#issuecomment-1021388471

Though we could split that up in its own ticket.

Implementation Brief

  • Install latest version of PHP-Scoper via Composer
  • Remove all the str_replace calls in the PHP-Scoper config
  • Install sniccwp/php-scoper-wordpress-excludes as a dev dependency and configure the exclude-classes, exclude-functions, and exclude-constants options accordingly

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
swissspidycommented, Feb 5, 2022

Awesome! That definitely makes me more confident that we can use this in this project.

1reaction
calvinalkancommented, Feb 4, 2022

@swissspidy Implemented now. We run a daily check against php-stubs/wordpress stubs and tag a new release automatically. Available at packagist now aswell.

We changed from .php to .json because with .php git would go mad on the numerically indexed array. It would show 6000 additions and deletions basically. With JSON it’s much clearer now what got updated and what got removed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Scoper] Improve the WP support experience #303 - GitHub
One straightforward way is to simply tell php-scoper to not prefix ... Update PHP-Scoper to v0.16.2 GoogleForCreators/web-stories-wp#10407.
Read more >
GraphQL API for WordPress is now scoped, thanks to PHP ...
Plugin GraphQL API for WordPress is now scoped. This means the plugin can be finally uploaded to the WordPress plugin directory.
Read more >
PHP Scoper: How to Avoid Namespace Issues in your ...
See how you can use PHP-Scoper to namespace your dependencies and avoid the world's worst knock-knock joke.
Read more >
This Week In GraphQL - Amazon S3
Release Version 16.2 · graphql-java/graphql-java · GitHub ... GraphQL API for WordPress is now scoped, thanks to PHP-Scoper!
Read more >
Google Cloud Talent Solution for PHP
v0.16.2 - Jan 12, 2022 ... update with latest version of protobuf (#3742) (a84e2a4) ... PHP-Scoper is a tool which essentially moves any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found