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

Complete dynamic properties for tests/Zend/** #289

Merged

Conversation

hungtrinh
Copy link

@hungtrinh hungtrinh commented Nov 22, 2022

Fix bug PHP 8.2: Dynamic Properties are deprecated' for test suite tests/Zend/**

Work Done

  • Removed #[AllowDynamicProperties] attribute added by me in tests/Zend/** at PR GitHub actions phpunit on php 8.2 & Fix bug on php 8.2 #275
  • Used rector to add real properties needed by test case class tests/Zend/** because i concerns #AllowDynamicProperties will removed in php >= 8.3
    $ ./bin/rector --no-diffs tests/
    This config help complete dynamic properties to class

    zf1-future/rector.php

    Lines 16 to 17 in 1f1cc46

    // https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#completedynamicpropertiesrector
    $rectorConfig->rule(CompleteDynamicPropertiesRector::class);

What next

After this PR merged into master, i will do the same thing for library/Zend to eliminate issue Creation of dynamic property xxx is deprecated in library/Zend

For Reviewer

Please keep my git commit signing by merge branch, please don't use rebase ^^

@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

For Reviewer

Please keep my git commit signing by merge branch, please don't use rebase ^^

Then you have to move those unrelated commits to separate PR. Remove rector changes from this PR and submit as a separate PR. You could submit them after this is merged if that makes a more logical order.

also noticed some commits have same title, these probably could be joined or the title is wrong? PHP 8.2: Add missing properties to classes tests/Zend/Queue/*

Also, remove "PHP 8.2: "prefix from messages to make them shorter (some are still wrapped over 72 chars), if someone wants to know if they are PHP 8.2 related they can see that from PR or from merge commit.

@hungtrinh hungtrinh marked this pull request as draft November 22, 2022 12:56
@hungtrinh
Copy link
Author

Firstly Mr @glensc please review #290

After that i will rebase and fix this PR according to your advice

The logical order is:

  1. Add rector tool Composer add dev tool Rector #290
  2. Use rector tool to do Complete dynamic properties for tests/Zend/** #289

@hungtrinh hungtrinh changed the title PHP 8.2 complete dynamic properties for tests/Zend/** Complete dynamic properties for tests/Zend/** Nov 22, 2022
@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

Don't worry about this PR make mistake on tests/Zend/** suite, everything verified by github action task phpunit for php 8.2 , php 8.1, php 8.0, php 8.4 (Everything success)

what does this sentence mean? what mistake?

@hungtrinh
Copy link
Author

I mean something bad like

  • syntax error
  • change test spec but don't have anything to verify

@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

Syntax errors will be caught by CI:

still, that sentence doesn't make any sense to me. remove it?

@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

btw, all properties were added as public. probably doesn't matter at all for tests what their visibility is. so not worth putting time into fixing t hem, unless you have clever way of doing that.

@hungtrinh
Copy link
Author

btw, all properties were added as public. probably doesn't matter at all for tests what their visibility is. so not worth putting time into fixing t hem, unless you have clever way of doing that.

Oh it's done by run ./bin/rector --no-diffs tests/ not take much time

@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

Oh it's done by run ./bin/rector --no-diffs tests/ not take much time

so, rector can figure out which property needs to be public, which one can be private/protected?

@hungtrinh
Copy link
Author

Oh it's done by run ./bin/rector --no-diffs tests/ not take much time

so, rector can figure out which property needs to be public, which one can be private/protected?

I think we can't do that at this time

Reference: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#completedynamicpropertiesrector

@glensc
Copy link
Collaborator

glensc commented Nov 22, 2022

that's why I said for tests/*.php they can all stay public.

@hungtrinh hungtrinh force-pushed the php82-complete-dynamic-properties-for-tests branch from b8fcc06 to f89ef2e Compare November 22, 2022 15:48
@hungtrinh
Copy link
Author

Mr. @glensc I followed your advice

  • Square 2 commit PHP 8.2: Add missing properties to classes tests/Zend/Queue/*
  • Removed "PHP 8.2: "prefix from messages

@hungtrinh hungtrinh marked this pull request as ready for review November 22, 2022 15:55
@Jimbolino
Copy link
Collaborator

so, rector can figure out which property needs to be public, which one can be private/protected?

I think we can't do that at this time

I actually opened a bug, after trying this too
rectorphp/rector#7574

Currently they hardcoded the missing properties to "MODIFIER_PUBLIC"
https://github.com/rectorphp/rector-src/blob/30afbb8da236ab0935851b91a7fb4b5cf26aa2e8/rules/CodeQuality/NodeFactory/MissingPropertiesFactory.php#L32

So before i ran rector, i manually edited the line to MODIFIER_PROTECTED :)

@hungtrinh
Copy link
Author

@Jimbolino thanks you, a good trick for test suite ^^

@hungtrinh hungtrinh marked this pull request as draft November 23, 2022 03:30
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Amf/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Application/Bootstrap/BootstrapTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Cache/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Captcha/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Config/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Controller/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Crypt/Rsa/RsaTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Date/DateObjectTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Dojo/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Dom/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/EventManager/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Feed/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Mail/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Measure/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Mobile/Push/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Oauth/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/OpenId/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Queue/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Stdlib/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Validate/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/XmlRpc/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/View/Helper/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/CurrencyTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/DateTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/FilterTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/LoaderTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/ValidateTest.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Gdata/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by:
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Service/AllTests.php
PHP 8.2: Dynamic Properties are deprecated fix

Reference: https://php.watch/versions/8.2/dynamic-properties-deprecated

Verified by: (not working right now, need migrate code Zend_Test_PHPUnit_ControllerTestCase support phpunit 9)
docker run -u "$(id -u):$(id -g)" -v $(pwd):$(pwd) -w $(pwd) -t --rm php:8.2-rc-cli-alpine -d memory_limit=-1 ./bin/phpunit -v --bootstrap tests/TestHelper.php tests/Zend/Test/PHPUnit/AllTests.php
@hungtrinh hungtrinh force-pushed the php82-complete-dynamic-properties-for-tests branch from f89ef2e to e352dd1 Compare November 23, 2022 04:22
@hungtrinh hungtrinh marked this pull request as ready for review November 23, 2022 04:24
@glensc
Copy link
Collaborator

glensc commented Nov 23, 2022

Too many changes to manually review. But as tests pass, this should be good enough.

@glensc glensc merged commit 713e3f4 into Shardj:master Nov 23, 2022
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request May 18, 2023
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request May 18, 2023
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request May 18, 2023
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request May 18, 2023
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request May 18, 2023
falkenhawk pushed a commit to zf1s/zf1 that referenced this pull request Jan 3, 2024
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.

3 participants