8000 [Filesystem] depreacte calling isAbsolutePath with a null · symfony/symfony@71d93f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71d93f9

Browse files
author
smoench
committed
[Filesystem] depreacte calling isAbsolutePath with a null
1 parent 64eaf7e commit 71d93f9

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ EventDispatcher
135135
Filesystem
136136
----------
137137

138+
* The `Filesystem::isAbsolutePath()` method no longer supports `null` in the `$file` argument.
138139
* The `Filesystem::dumpFile()` method no longer supports arrays in the `$content` argument.
139140
* The `Filesystem::appendToFile()` method no longer supports arrays in the `$content` argument.
140141

src/Symfony/Component/Filesystem/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.4.0
5+
-----
6+
7+
* support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated and will be removed in 5.0
8+
49
4.3.0
510
-----
611

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
600600
*/
601601
public function isAbsolutePath($file)
602602
{
603+
if (null === $file) {
604+
@trigger_error(sprintf('Calling "%s()" with a null in the $file argument is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED);
605+
}
606+
603607
return strspn($file, '/\\', 0, 1)
604608
|| (\strlen($file) > 3 && ctype_alpha($file[0])
605609
&& ':' === $file[1]

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,15 @@ public function providePathsForIsAbsolutePath()
14011401
];
14021402
}
14031403

1404+
/**
1405+
* @group legacy
1406+
* @expectedDeprecation Calling "Symfony\Component\Filesystem\Filesystem::isAbsolute()" with a null in the $file argument is deprecated since Symfony 4.3.
1407+
*/
1408+
public function testIsAbsolutePathWithNull()
1409+
{
1410+
$this->assertFalse($this->filesystem->isAbsolutePath(null));
1411+
}
1412+
14041413
public function testTempnam()
14051414
{
14061415
$dirname = $this->workspace;

0 commit comments

Comments
 (0)
0