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

PHP 8.0 "attribute" use statement incorrectly prefixed or breaks prefixing entirely #539

Closed
moorscode opened this issue Oct 28, 2021 · 2 comments
Labels

Comments

@moorscode
Copy link
Contributor

moorscode commented Oct 28, 2021

Bug report

Question Answer
PHP-Scoper version 0.15.0
PHP version all
Platform with version all

Prefixing of PHP 8.0+ attributes is not behaving consistently.

When using a single line attribute, which is imported using a use statement, the class in the use statement is being prefixed.

However, when using the fully qualified classname in the inline attribute call or using a multiline attribute notation the build files are created with expected prefixes (the incorrect prefix is not being added).

Correction on the assumption that multiline attributes were giving the desired results.
Whenever an attribute is defined over multiple lines, the "source" file is being placed in the build directory without any errors or warnings, but also without any prefixes.

I've added a "neutral" use SomethingElse; to the source files to validate that prefixing happens, though this statement is not being prefixed in the multiline-*.php files in the build results.

Steps to reproduce:

  1. Clone the main branch of the php-scoper-attributes-prefixed-poc repository
  2. Run composer install
  3. Run php ./vendor/humbug/php-scoper/bin/php-scoper add-prefix
  4. Inspect the files in the build directory and see use TestPrefix\ReturnTypeWillChange; instead of the use ReturnTypeWillChange; statement in the inline-with-use.php file
moorscode added a commit to Yoast/wordpress-seo that referenced this issue Oct 28, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Oct 28, 2021
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
@moorscode moorscode changed the title PHP 8.0 Parameter use statement incorrectly prefixed PHP 8.0 "parameter" use statement incorrectly prefixed or breaks prefixing entirely Oct 28, 2021
@moorscode moorscode changed the title PHP 8.0 "parameter" use statement incorrectly prefixed or breaks prefixing entirely PHP 8.0 "attribute" use statement incorrectly prefixed or breaks prefixing entirely Oct 28, 2021
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Nov 11, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Nov 30, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Nov 30, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 6, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 9, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 16, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 16, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 20, 2021
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
jrfnl pushed a commit to Yoast/wordpress-seo that referenced this issue Dec 23, 2021
PHP Scoper is prefixing the attribute use statement that will need to be pulled into the TheLeague OAuth Client implementation of the `JSONSerializable` interface.
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 it still does not work as desired on the newer version. Bumping the version in this commit seemed out of scope.

PHP 8.1 compatibility for PHP Scoper is being tracked in the following ticket: humbug/php-scoper#539
@theofidry theofidry added the bug label Feb 11, 2022
@theofidry
Copy link
Member

Will be fixed in the next release. Not entirely sure if it's capture completely by #738, but I tried scoping the reproducer repository with the latest state of main and it works.

@jrfnl
Copy link

jrfnl commented Nov 12, 2022

Happy to hear that. Thank you @theofidry !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants