-
Notifications
You must be signed in to change notification settings - Fork 660
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
Fix #9997 dynamic properties on SimpleXmlElement #10049
Fix #9997 dynamic properties on SimpleXmlElement #10049
Conversation
3cc8503
to
2257d7e
Compare
src/Psalm/Type/Atomic.php
Outdated
} | ||
|
||
return new TNamedObject($value); | ||
return new TNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will prevent this to work in PHP <7: https://3v4l.org/nbaYr
aside from the change in Atomic, this seems good :) |
2257d7e
to
33db549
Compare
33db549
to
9b77760
Compare
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate - added typed magic __get method to SimpleXmlElement - adjusted tests to reflect new behaviour of SimpleXmlElement - added tests
9b77760
to
a4de6d9
Compare
@@ -323,7 +323,7 @@ private static function createInner( | |||
return $analysis_php_version_id !== null ? new TNamedObject($value) : new TScalar(); | |||
|
|||
case 'null': | |||
if ($analysis_php_version_id === null || $analysis_php_version_id >= 8_00_00) { | |||
if ($analysis_php_version_id === null || $analysis_php_version_id >= 7_00_00) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then lets use this code in PHP<7
@orklah ready to merge. psl fail seems unrelated |
Thanks! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [google/protobuf](https://developers.google.com/protocol-buffers/) ([source](https://github.com/protocolbuffers/protobuf-php)) | require | minor | `3.23.4` -> `3.24.1` | | [grpc/grpc](https://grpc.io) ([source](https://github.com/grpc/grpc-php)) | require | minor | `1.52.0` -> `1.57.0` | | [phpstan/phpstan](https://github.com/phpstan/phpstan) | require-dev | patch | `1.10.27` -> `1.10.29` | | [phpunit/phpunit](https://phpunit.de/) ([source](https://github.com/sebastianbergmann/phpunit)) | require-dev | patch | `10.3.1` -> `10.3.2` | | [vimeo/psalm](https://github.com/vimeo/psalm) | require-dev | minor | `5.14.1` -> `5.15.0` | --- ### Release Notes <details> <summary>protocolbuffers/protobuf-php (google/protobuf)</summary> ### [`v3.24.1`](https://github.com/protocolbuffers/protobuf-php/compare/v3.24.0...v3.24.1) [Compare Source](https://github.com/protocolbuffers/protobuf-php/compare/v3.24.0...v3.24.1) ### [`v3.24.0`](https://github.com/protocolbuffers/protobuf-php/compare/v3.23.4...v3.24.0) [Compare Source](https://github.com/protocolbuffers/protobuf-php/compare/v3.23.4...v3.24.0) </details> <details> <summary>grpc/grpc-php (grpc/grpc)</summary> ### [`v1.57.0`](https://github.com/grpc/grpc-php/compare/v1.52.0...v1.57.0) [Compare Source](https://github.com/grpc/grpc-php/compare/v1.52.0...v1.57.0) </details> <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.29`](https://github.com/phpstan/phpstan/releases/tag/1.10.29) [Compare Source](https://github.com/phpstan/phpstan/compare/1.10.28...1.10.29) # Improvements 🔧 - Update nikic/php-parser to v4.17.1 - PHP 8.3 features are no longer parse errors. Full-fledged PHP 8.3 support is coming later this year. - Update BetterReflection to 6.12.0 # Bugfixes 🐛 - PHPStan Pro - when launching, `PHP_BINARY` needs to be escaped (phpstan/phpstan-src@2c7cfd8) # Function signature fixes 🤖 - Fix FTP-related function signatures ([#​2551](https://github.com/phpstan/phpstan-src/pull/2551)), thanks [@​thg2k](https://github.com/thg2k)! ### [`v1.10.28`](https://github.com/phpstan/phpstan/releases/tag/1.10.28) [Compare Source](https://github.com/phpstan/phpstan/compare/1.10.27...1.10.28) # Improvements 🔧 - Update BetterReflection to 6.12.0 (phpstan/phpstan-src@7c49c94) # Bugfixes 🐛 - Nullsafe operator on `null` results in `null` (phpstan/phpstan-src@5c40c85), [#​9721](https://github.com/phpstan/phpstan/issues/9721) - Properties set in the native constructor are initialized in additional constructors (phpstan/phpstan-src@1b0c6a0), [#​9619](https://github.com/phpstan/phpstan/issues/9619) - Fix performance problem with nested BooleanOr and BooleanAnd (phpstan/phpstan-src@9adae6c), [#​9690](https://github.com/phpstan/phpstan/issues/9690), [#​9676](https://github.com/phpstan/phpstan/issues/9676) - CallableTypeHelper - copy variadic parameters if the accepting closure has more parameters (phpstan/phpstan-src@31ed326), [#​9699](https://github.com/phpstan/phpstan/issues/9699) # Internals 🔍 - Simplify access to ClassReflection in ClassPropertyNode ([#​2565](https://github.com/phpstan/phpstan-src/pull/2565)), thanks [@​mad-briller](https://github.com/mad-briller)! </details> <details> <summary>sebastianbergmann/phpunit (phpunit/phpunit)</summary> ### [`v10.3.2`](https://github.com/sebastianbergmann/phpunit/compare/10.3.1...10.3.2) [Compare Source](https://github.com/sebastianbergmann/phpunit/compare/10.3.1...10.3.2) </details> <details> <summary>vimeo/psalm (vimeo/psalm)</summary> ### [`v5.15.0`](https://github.com/vimeo/psalm/releases/tag/5.15.0) [Compare Source](https://github.com/vimeo/psalm/compare/5.14.1...5.15.0) <!-- Release notes generated using configuration in .github/release.yml at 5.x --> #### What's Changed ##### Features - Check if argument passed to isset() is not a variable by [@​Nitamet](https://github.com/Nitamet) in [https://github.com/vimeo/psalm/pull/10068](https://github.com/vimeo/psalm/pull/10068) - Fix [#​9997](https://github.com/vimeo/psalm/issues/9997) dynamic properties on SimpleXmlElement by [@​ygottschalk](https://github.com/ygottschalk) in [https://github.com/vimeo/psalm/pull/10049](https://github.com/vimeo/psalm/pull/10049) - Nicer PHP version checking by [@​Nitamet](https://github.com/Nitamet) in [https://github.com/vimeo/psalm/pull/10129](https://github.com/vimeo/psalm/pull/10129) ##### Fixes - Fixed `DOMDocument::load*` signatures by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10073](https://github.com/vimeo/psalm/pull/10073) - make (s)printf error reporting more correct/literal by [@​kkmuffme](https://github.com/kkmuffme) in [https://github.com/vimeo/psalm/pull/10088](https://github.com/vimeo/psalm/pull/10088) - Fix parameter having `object` type in PHPDoc and only `&` in the method's definition, used with code having an object calling it's method with itself as an argument for mentioned parameter by [@​kubawerlos](https://github.com/kubawerlos) in [https://github.com/vimeo/psalm/pull/10104](https://github.com/vimeo/psalm/pull/10104) - mysqli_field_seek returns true by [@​kamil-tekiela](https://github.com/kamil-tekiela) in [https://github.com/vimeo/psalm/pull/10107](https://github.com/vimeo/psalm/pull/10107) - Fix bcdiv nullable scale stub by [@​TheDevick](https://github.com/TheDevick) in [https://github.com/vimeo/psalm/pull/10106](https://github.com/vimeo/psalm/pull/10106) - Cleanup `test` command and `fixAll` action by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10108](https://github.com/vimeo/psalm/pull/10108) - Correct type for `$enum->name` by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10109](https://github.com/vimeo/psalm/pull/10109) - argv and argc were inconsistent in Context with VariableFetchAnalyzer by [@​kkmuffme](https://github.com/kkmuffme) in [https://github.com/vimeo/psalm/pull/10093](https://github.com/vimeo/psalm/pull/10093) - Fix `hash_pbkdf2` `$options` parameter by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10110](https://github.com/vimeo/psalm/pull/10110) - Forbid faulty `nikic/php-parser` version by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10112](https://github.com/vimeo/psalm/pull/10112) - `strip_tags()/$allowed_tags` can accept arrays since 7.4 by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10122](https://github.com/vimeo/psalm/pull/10122) - Fix crash when assertion array is not a list by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10123](https://github.com/vimeo/psalm/pull/10123) - Fix crash on array access to undefined class by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10134](https://github.com/vimeo/psalm/pull/10134) - Correct exit code for invalid version format by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10135](https://github.com/vimeo/psalm/pull/10135) #### New Contributors - [@​Nitamet](https://github.com/Nitamet) made their first contribution in [https://github.com/vimeo/psalm/pull/10068](https://github.com/vimeo/psalm/pull/10068) - [@​TheDevick](https://github.com/TheDevick) made their first contribution in [https://github.com/vimeo/psalm/pull/10106](https://github.com/vimeo/psalm/pull/10106) **Full Changelog**: vimeo/psalm@5.14.1...5.15.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/cerbos/cerbos-sdk-php). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi40MC4zIiwidXBkYXRlZEluVmVyIjoiMzYuNDMuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [vimeo/psalm](https://github.com/vimeo/psalm) | require-dev | minor | `~5.14.0` -> `~5.15.0` | --- ### Release Notes <details> <summary>vimeo/psalm (vimeo/psalm)</summary> ### [`v5.15.0`](https://github.com/vimeo/psalm/releases/tag/5.15.0) [Compare Source](https://github.com/vimeo/psalm/compare/5.14.1...5.15.0) <!-- Release notes generated using configuration in .github/release.yml at 5.x --> #### What's Changed ##### Features - Check if argument passed to isset() is not a variable by [@​Nitamet](https://github.com/Nitamet) in [https://github.com/vimeo/psalm/pull/10068](https://github.com/vimeo/psalm/pull/10068) - Fix [#​9997](https://github.com/vimeo/psalm/issues/9997) dynamic properties on SimpleXmlElement by [@​ygottschalk](https://github.com/ygottschalk) in [https://github.com/vimeo/psalm/pull/10049](https://github.com/vimeo/psalm/pull/10049) - Nicer PHP version checking by [@​Nitamet](https://github.com/Nitamet) in [https://github.com/vimeo/psalm/pull/10129](https://github.com/vimeo/psalm/pull/10129) ##### Fixes - Fixed `DOMDocument::load*` signatures by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10073](https://github.com/vimeo/psalm/pull/10073) - make (s)printf error reporting more correct/literal by [@​kkmuffme](https://github.com/kkmuffme) in [https://github.com/vimeo/psalm/pull/10088](https://github.com/vimeo/psalm/pull/10088) - Fix parameter having `object` type in PHPDoc and only `&` in the method's definition, used with code having an object calling it's method with itself as an argument for mentioned parameter by [@​kubawerlos](https://github.com/kubawerlos) in [https://github.com/vimeo/psalm/pull/10104](https://github.com/vimeo/psalm/pull/10104) - mysqli_field_seek returns true by [@​kamil-tekiela](https://github.com/kamil-tekiela) in [https://github.com/vimeo/psalm/pull/10107](https://github.com/vimeo/psalm/pull/10107) - Fix bcdiv nullable scale stub by [@​TheDevick](https://github.com/TheDevick) in [https://github.com/vimeo/psalm/pull/10106](https://github.com/vimeo/psalm/pull/10106) - Cleanup `test` command and `fixAll` action by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10108](https://github.com/vimeo/psalm/pull/10108) - Correct type for `$enum->name` by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10109](https://github.com/vimeo/psalm/pull/10109) - argv and argc were inconsistent in Context with VariableFetchAnalyzer by [@​kkmuffme](https://github.com/kkmuffme) in [https://github.com/vimeo/psalm/pull/10093](https://github.com/vimeo/psalm/pull/10093) - Fix `hash_pbkdf2` `$options` parameter by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10110](https://github.com/vimeo/psalm/pull/10110) - Forbid faulty `nikic/php-parser` version by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10112](https://github.com/vimeo/psalm/pull/10112) - `strip_tags()/$allowed_tags` can accept arrays since 7.4 by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10122](https://github.com/vimeo/psalm/pull/10122) - Fix crash when assertion array is not a list by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10123](https://github.com/vimeo/psalm/pull/10123) - Fix crash on array access to undefined class by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10134](https://github.com/vimeo/psalm/pull/10134) - Correct exit code for invalid version format by [@​weirdan](https://github.com/weirdan) in [https://github.com/vimeo/psalm/pull/10135](https://github.com/vimeo/psalm/pull/10135) #### New Contributors - [@​Nitamet](https://github.com/Nitamet) made their first contribution in [https://github.com/vimeo/psalm/pull/10068](https://github.com/vimeo/psalm/pull/10068) - [@​TheDevick](https://github.com/TheDevick) made their first contribution in [https://github.com/vimeo/psalm/pull/10106](https://github.com/vimeo/psalm/pull/10106) **Full Changelog**: vimeo/psalm@5.14.1...5.15.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-feature/php-sdk). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi40My4yIiwidXBkYXRlZEluVmVyIjoiMzYuNDMuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Refs #9997
Types dynamic property access on
SimpleXmlElement
toSimpleXmlElement|null
.BC impact:
SimpleXmlElement
is not considered an universal object crate anymore. Therefore things like$xmlElement->myExtraStringData = 'fooBar';
will not work anymore when this get merged.I do not know why this code was in place and I am not sure if my changes are 'legit': https://github.com/vimeo/psalm/pull/10049/files#diff-a3219413916e4af22971b07d3ef169950d3b17b7cf58f48366c408b1d49ade5bR326
I looked through Atomic.php and some other file and it seemed like null checks (in most places) are done by checking
$atomic instanceof TNull
and not consideringTNamedObject('null')
asnull
. Thats why I removed the code...Extra info copied from commit message
null
toTNamedObject('null')
instead ofTNull