-
Notifications
You must be signed in to change notification settings - Fork 662
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
Resolving deep mixins #11082
base: 5.x
Are you sure you want to change the base?
Resolving deep mixins #11082
Commits on Sep 9, 2024
-
Part 1. Fail tests of named mixins with object methods
Problems: ``` 1) Psalm\Tests\MixinsDeepTest::testValidCode with data set "NamedMixinsWithoutT_WithObjectMethods" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:22:1 - Unable to determine the type that $a is being assigned to 2) Psalm\Tests\MixinsDeepTest::testValidCode with data set "NamedMixinsWithT_WithObjectMethods" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:37:1 - Unable to determine the type that $a is being assigned to ```
Configuration menu - View commit details
-
Copy full SHA for d8bea79 - Browse repository at this point
Copy the full SHA d8bea79View commit details -
Part 1. Moving code into the handleMixins method
Creating the `handleMixins` method is necessary so that it can be used in the future for recursive calls from the `handleTemplatedMixins` and `handleRegularMixins` methods. A recursive call to this method will allow us to search the depth of the mixins.
Configuration menu - View commit details
-
Copy full SHA for a1992a7 - Browse repository at this point
Copy the full SHA a1992a7View commit details -
Part 1. Add variable method_exists
Deep processing of mixins is planned to be done through recursive calls to the `handleMixins` method. To realise this, we need this method to return information that it has managed to find the desired method. Therefore, the `method_exists` variable was declared to make it clear that the method was found. The existing `naive_method_exists` variable is not suitable for us, because it is not set to `true` if the method is magic (pseudo).
Configuration menu - View commit details
-
Copy full SHA for 8cf6dbf - Browse repository at this point
Copy the full SHA 8cf6dbfView commit details -
Part 1. Extracting variables in the handleRegularMixins method
Extracting variables defined in the "if" statement block to the upper lines. All this is necessary to use these variables for further searching at the next deeper level of mixins, passing them to the `handleMixins` method, performing recursion in this way. Extracting code from: ``` if ($codebase->methods->methodExists(...)) { // here extracted } ```
Configuration menu - View commit details
-
Copy full SHA for 0e665e5 - Browse repository at this point
Copy the full SHA 0e665e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72817c1 - Browse repository at this point
Copy the full SHA 72817c1View commit details -
Part 2. Fail tests of templated mixins with object methods
Problems: ``` 1) Psalm\Tests\MixinsDeepTest::testValidCode with data set "TemplatedMixins_WithObjectMethods" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:25:1 - Unable to determine the type that $a is being assigned to ```
Configuration menu - View commit details
-
Copy full SHA for bfd2937 - Browse repository at this point
Copy the full SHA bfd2937View commit details -
Part 2. Refactoring the handleTemplatedMixins method
Extracting code from: ``` if ($codebase->methods->methodExists(...)) { // here extracted } elseif (...) { // here extracted } ```
Configuration menu - View commit details
-
Copy full SHA for fecae81 - Browse repository at this point
Copy the full SHA fecae81View commit details -
Part 2. Overriding the fq_class_name variable
Comparing the `handleTemplatedMixins` and `handleRegularMixins` methods, we can notice that in the `handleRegularMixins` method the `fq_class_name` variable is overridden if the sought method is found in the mixin. Whereas in the `handleTemplatedMixins` method this does not happen. And I think therein lies the error. Since the `class_storage` variable can be overridden in the `handleTemplatedMixins` method, the `fq_class_name` variable should also be overridden.
Configuration menu - View commit details
-
Copy full SHA for 229c072 - Browse repository at this point
Copy the full SHA 229c072View commit details -
Configuration menu - View commit details
-
Copy full SHA for 95e2e54 - Browse repository at this point
Copy the full SHA 95e2e54View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd71295 - Browse repository at this point
Copy the full SHA cd71295View commit details -
Part 4. Fail tests of named mixins with static methods
Problems: ``` 1) Psalm\Tests\MixinsDeepTest::testValidCode with data set "NamedMixinsWithoutT_WithStaticMethods" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:25:1 - Unable to determine the type that $a is being assigned to 2) Psalm\Tests\MixinsDeepTest::testValidCode with data set "NamedMixinsWithT_WithStaticMethods" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:39:1 - Unable to determine the type that $a is being assigned to ```
Configuration menu - View commit details
-
Copy full SHA for c5ea30e - Browse repository at this point
Copy the full SHA c5ea30eView commit details -
Part 4. Moving code into the handleRegularMixins method
Creating this method is necessary to be able to make recursive calls using this method in the next step.
Configuration menu - View commit details
-
Copy full SHA for ecbb340 - Browse repository at this point
Copy the full SHA ecbb340View commit details -
Part 4. Resolve tests of named mixins with static methods
Added recursive call
Configuration menu - View commit details
-
Copy full SHA for 0d0a8b5 - Browse repository at this point
Copy the full SHA 0d0a8b5View commit details -
Part 5. Fail tests of mixins with properties
Problems: ``` 1) Psalm\Tests\MixinsDeepTest::testValidCode with data set "NamedMixinsWithoutT_WithObjectProperties" Psalm\Exception\CodeException: MixedAssignment - src/somefile.php:23:1 - Unable to determine the type that $a is being assigned to ```
Configuration menu - View commit details
-
Copy full SHA for 08b50d6 - Browse repository at this point
Copy the full SHA 08b50d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for d681ca3 - Browse repository at this point
Copy the full SHA d681ca3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ce8418 - Browse repository at this point
Copy the full SHA 0ce8418View commit details -
Configuration menu - View commit details
-
Copy full SHA for 635d38e - Browse repository at this point
Copy the full SHA 635d38eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 83b437a - Browse repository at this point
Copy the full SHA 83b437aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b206f1a - Browse repository at this point
Copy the full SHA b206f1aView commit details
Commits on Sep 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 021c77b - Browse repository at this point
Copy the full SHA 021c77bView commit details