Skip to content

Encapsed literal strings#8164

Merged
orklah merged 5 commits intovimeo:4.xfrom
AndrolGenhald:encapsed-literal-strings
Jun 26, 2022
Merged

Encapsed literal strings#8164
orklah merged 5 commits intovimeo:4.xfrom
AndrolGenhald:encapsed-literal-strings

Conversation

@AndrolGenhald
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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