Skip to content

Commit

Permalink
PHP 8.0 | Update OAuth PHP Scoper config
Browse files Browse the repository at this point in the history
PHP Scoper is prefixing the attribute use statement that will need to be pulled into the TheLeague OAuth Client implenetation of the JSONSerializableInterface.
See thephpleague/oauth2-client#919

This change removes the prefix from the use statement.

PHP Scoper was updated to 0.15.0 during investigation of this issue and was not worked as desired on the newer version. Bumping the version in this commit seemed out of scope.

This is addressed in the following ticket: humbug/php-scoper#539
  • Loading branch information
moorscode authored and jrfnl committed Nov 30, 2021
1 parent aa52607 commit 9198818
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/php-scoper/oauth2-client.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
/*
* Restore incorrect PHP 8.0+ attribute use statement prefix.
*
* This implementation is not ideal, php-scoper should be improved to deal with this.
* php-scoper is not yet PHP 8.0 compatible in run-time either, not expecting a fix soon.
*
* This was tested with php-scoper 0.15.0 - but not committed as it seemed out of scope.
*
* This will become relevant when the following PR is merged and the dependency is upgraded
* to the released version.
*
* https://github.com/thephpleague/oauth2-client/pull/919
*/
$content = str_replace(
sprintf( 'use %s\ReturnTypeWillChange;', $prefix ),
'use ReturnTypeWillChange;',
$content
);

// 26 is the length of the GrantFactory.php file path.
if ( substr( $file_path, -26 ) !== 'src/Grant/GrantFactory.php' ) {
return $content;
Expand Down

0 comments on commit 9198818

Please sign in to comment.