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

Drop triun/longest-common-substring dependency #379

Merged
merged 6 commits into from
Mar 14, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 14, 2023

@staabm staabm marked this pull request as ready for review March 14, 2023 09:58
@staabm
Copy link
Contributor Author

staabm commented Mar 14, 2023

phpstan reports

-1 Out of 882 possible return types, only 99 % actually have it. Add more return types to get over 100 %

but I don't see a single method which does not declare its return type?

@@ -37,6 +37,9 @@ parameters:
message: '#Instead of "instanceof/is_a\(\)" use ReflectionProvider service or "\(new ObjectType\(<desired_type\>\)\)\-\>isSuperTypeOf\(<element_type\>\)" for static reflection to work#'
path: src/ValueObjectFactory/ServiceMapFactory.php

- '#Cognitive complexity for "Rector\\Symfony\\Rector\\Closure\\MinimalSharedStringSolver\:\:solve\(\)" is (.*?), keep it under 10#'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to ignore this error, since I don't want to fiddle in this "external" code and introduce bugs since we don't know all the details

Comment on lines -109 to -111
if (! is_string($sharedNamespace)) {
return null;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since the MinimalSharedStringSolver no longer implements the Solver interface, we were able to declare more specific return types which also means this case - which was never taken, as null could technically not be returned - can be dropped.

@samsonasik samsonasik merged commit 6a67780 into rectorphp:main Mar 14, 2023
@samsonasik
Copy link
Member

Thank you @staabm

@staabm staabm deleted the inline-solver branch March 14, 2023 10:15
/**
* Class Solver copied from https://github.com/Triun/PHP-Longest-Common-Substring
*/
final class MinimalSharedStringSolver
Copy link
Member

Choose a reason for hiding this comment

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

@staabm This needs a test, as there is lot of tiny coding happening here.
Could you add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, here you are: #380

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.

Parse error: syntax error, unexpected token "match"
3 participants