-
Notifications
You must be signed in to change notification settings - Fork 15
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
Remove deprecated usage of function #310
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e0c816c
remove deprecated usage of function
SergeiMV 9452823
remove iconv extension, add comments and tests
SergeiMV d7342ef
Remove php 8.1 (#308)
funivan 672a1f9
refactor tests
SergeiMV bdb6568
remove deprecated usage of function
SergeiMV 17556e0
remove iconv extension, add comments and tests
SergeiMV 4e74035
refactor tests
SergeiMV 0ad6926
Merge remote-tracking branch 'origin/master'
SergeiMV ff73409
fix code style
SergeiMV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
phpunit.xml.dist export-ignore | ||
tests export-ignore | ||
docs export-ignore | ||
|
||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
tests/Collection/Filters/StringFilter/RegexStringFilterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace Test\Xparse\ElementFinder\Collection; | ||
|
||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
use Test\Xparse\ElementFinder\Collection\Dummy\JoinedBy; | ||
use Test\Xparse\ElementFinder\Collection\Dummy\WithLetterFilter; | ||
|
@@ -12,7 +13,7 @@ | |
/** | ||
* @author Ivan Shcherbak <[email protected]> | ||
*/ | ||
class StringCollectionTest extends TestCase | ||
final class StringCollectionTest extends TestCase | ||
{ | ||
public function testInvalidObjectIndex(): void | ||
{ | ||
|
@@ -87,10 +88,12 @@ public function testMergeWithPartialItems(): void | |
{ | ||
$collection = (new StringCollection([ | ||
1 => 'a', | ||
]))->merge(new StringCollection([ | ||
1 => 'b', | ||
'c', | ||
])); | ||
]))->merge( | ||
new StringCollection([ | ||
1 => 'b', | ||
'c', | ||
]) | ||
); | ||
self::assertSame(['a', 'b', 'c'], $collection->all()); | ||
} | ||
|
||
|
@@ -128,7 +131,8 @@ public function testFilter(): void | |
|
||
self::assertSame( | ||
[ | ||
'bar', 'baz', | ||
'bar', | ||
'baz', | ||
], | ||
$collection->all() | ||
); | ||
|
@@ -148,9 +152,7 @@ public function testMap(): void | |
); | ||
} | ||
|
||
/** | ||
* @dataProvider lastDataProvider | ||
*/ | ||
#[DataProvider('lastDataProvider')] | ||
public function testLast(array $items, mixed $expected): void | ||
{ | ||
$collection = new StringCollection($items); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we can use
![image](https://private-user-images.githubusercontent.com/425208/395854484-f05ca4a5-4a42-493f-a899-3e0b15fbbe6c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDQxMjQsIm5iZiI6MTczOTAwMzgyNCwicGF0aCI6Ii80MjUyMDgvMzk1ODU0NDg0LWYwNWNhNGE1LTRhNDItNDkzZi1hODk5LTNlMGIxNWZiYmU2Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQwODM3MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xM2UwMTEyMThiNGRjNDc3YTJhYzZjMGViNzc4MTRiMmNjZmIzZGQ3ZmZkMmIzYWViZDY1ZmU5NWE0Y2MzODBhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9._XXGi--SepergKm7ZzTJ8SlLVY_Fzuz4zrncV0lS058)
htmlentities
Have you tried it?
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.
When using only htmlentities, some special characters will remain encoded, as shown in the screenshot above. To decode them, you need to use htmlspecialchars_decode, and also use mb_encode_numericentity to properly handle characters in UTF-8 encoding.
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.
Could you give an example when special symbols are not encoded? I want to check this strings on both converters current and a new one.
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.
I meant that if you use only
htmlentities
, then the characters"'&<>
will remain encoded and you will need to additionally usehtml_entity_decode
to convert them.In addition, if you use only
![image](https://private-user-images.githubusercontent.com/92272880/396996251-108f5485-9e42-493f-b08d-59d0bf94c77c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDQxMjQsIm5iZiI6MTczOTAwMzgyNCwicGF0aCI6Ii85MjI3Mjg4MC8zOTY5OTYyNTEtMTA4ZjU0ODUtOWU0Mi00OTNmLWIwOGQtNTlkMGJmOTRjNzdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA4MzcwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1ZmVkOTY1YzU3MjJkNTcxODMyNjM5MGE0ZGY4YmJmZmY3Zjc1YTVjM2IyNGFmOTI0MzlmYjZjMDk2YTAxNTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.p8Rd0AEW_9w_IGDzjXz268dOTeFS7VKGfSAauUzPCjU)
htmlentities
andhtml_entity_decode
, then in the tests I added you will see that in the second case, when "broken" characters are used,htmlentities
successfully removes them, but in the first test case, instead of "Текст текст" it will output ТекÑ... and so on.