Skip to content

Commit 2d3a1ad

Browse files
minor #53073 Set strict parameter of in_array to true where possible (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- Set `strict` parameter of `in_array` to true where possible | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This pull request introduces a comprehensive update where the `in_array` function is now consistently invoked with the `strict` parameter set to `true`. This change is implemented across various components of the framework to enhance type safety and reliability. To me, this update is a step towards more explicit and error-resistant code. Commits ------- 442329a50f Set `strict` parameter of `in_array` to true where possible
2 parents c5254cd + ef01271 commit 2d3a1ad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Path.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ public static function join(string ...$paths): string
668668
}
669669

670670
// Only add slash if previous part didn't end with '/' or '\'
671-
if (!\in_array(substr($finalPath, -1), ['/', '\\'])) {
671+
if (!\in_array(substr($finalPath, -1), ['/', '\\'], true)) {
672672
$finalPath .= '/';
673673
}
674674

Tests/FilesystemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
167167
*/
168168
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
169169
{
170-
if (!\in_array('https', stream_get_wrappers())) {
170+
if (!\in_array('https', stream_get_wrappers(), true)) {
171171
$this->markTestSkipped('"https" stream wrapper is not enabled.');
172172
}
173173
$sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png';

0 commit comments

Comments
 (0)