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

Encapsed literal strings #8164

Merged
merged 5 commits into from
Jun 26, 2022
Merged

Conversation

AndrolGenhald
Copy link
Collaborator

  • Infer literal string from encapsed string.
  • Allow casting literal float to literal string
  • Improve concatenation of literals to allow literal floats, avoid long loop if there are too many combinations instead of checking after loop
  • Improve AssertionFinder::hasNonEmptyCountEqualityCheck() and add tests for Infer non-empty assertion from count with variable #8163

@AndrolGenhald AndrolGenhald added the release:feature The PR will be included in 'Features' section of the release notes label Jun 25, 2022
@AndrolGenhald AndrolGenhald requested a review from orklah June 25, 2022 03:04
&& $conditional->left->value >= (
$conditional instanceof PhpParser\Node\Expr\BinaryOp\Smaller ? 0 : 1
)
// TODO get node type provider here somehow and check literal ints and int ranges
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can pass $source from caller method and then do $source->getNodeTypeProvider() if you want

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't believe I missed that, I was looking for a StatementsAnalyzer... I'm about done for now, but I'll come fix that in the next day or so.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise, the rest seems good :) Give me a sign when it's ready ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, well this is actually a bit complicated. I got it all working, but I got a couple RedundantConditions... I have to figure out a way to make the assertion not redundant if $foo and $bar are both non-empty and there's an assertion for count($foo) === count($bar).

Go ahead and merge this, I'll have to dig deeper later. I'll probably see if I can fix this on master along with #7096.

@orklah orklah merged commit b3038f0 into vimeo:4.x Jun 26, 2022
@orklah
Copy link
Collaborator

orklah commented Jun 26, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature The PR will be included in 'Features' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants