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

Deprecate getter,setter and protected methods in RenameUpload #224

Open
wants to merge 1 commit into
base: 2.41.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,27 @@
<DeprecatedClass>
<code><![CDATA[AbstractFilter]]></code>
</DeprecatedClass>
<DeprecatedMethod>
<code><![CDATA[applyRandomToFilename]]></code>
<code><![CDATA[checkFileExists]]></code>
<code><![CDATA[checkFileExists]]></code>
<code><![CDATA[checkFileExists]]></code>
<code><![CDATA[getFinalTarget]]></code>
<code><![CDATA[getFinalTarget]]></code>
<code><![CDATA[getFinalTarget]]></code>
<code><![CDATA[getOverwrite]]></code>
<code><![CDATA[getRandomize]]></code>
<code><![CDATA[getRandomize]]></code>
<code><![CDATA[getStreamFactory]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getUploadFileFactory]]></code>
<code><![CDATA[getUseUploadExtension]]></code>
<code><![CDATA[getUseUploadExtension]]></code>
<code><![CDATA[getUseUploadName]]></code>
<code><![CDATA[moveUploadedFile]]></code>
<code><![CDATA[moveUploadedFile]]></code>
<code><![CDATA[setTarget]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
<code><![CDATA[$target === null]]></code>
<code><![CDATA[is_string($target)]]></code>
Expand Down Expand Up @@ -2080,6 +2101,28 @@
</PossiblyUnusedMethod>
</file>
<file src="test/File/RenameUploadTest.php">
<DeprecatedMethod>
<code><![CDATA[getOverwrite]]></code>
<code><![CDATA[getOverwrite]]></code>
<code><![CDATA[getOverwrite]]></code>
<code><![CDATA[getRandomize]]></code>
<code><![CDATA[getRandomize]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getUseUploadName]]></code>
<code><![CDATA[getUseUploadName]]></code>
<code><![CDATA[setStreamFactory]]></code>
<code><![CDATA[setUploadFileFactory]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[1234]]></code>
</InvalidArgument>
Expand Down
36 changes: 36 additions & 0 deletions src/File/RenameUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function __construct($targetOrOptions = [])
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param StreamFactoryInterface $factory Factory to use to produce a PSR-7
* stream with which to seed a PSR-7 UploadedFileInterface.
* @return self
Expand All @@ -91,6 +93,8 @@ public function setStreamFactory(StreamFactoryInterface $factory)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return null|StreamFactoryInterface
*/
public function getStreamFactory()
Expand All @@ -99,6 +103,8 @@ public function getStreamFactory()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param string $target Target file path or directory
* @return self
*/
Expand All @@ -114,6 +120,8 @@ public function setTarget($target)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return string Target file path or directory
*/
public function getTarget()
Expand All @@ -122,6 +130,8 @@ public function getTarget()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param UploadedFileFactoryInterface $factory Factory to use to produce
* filtered PSR-7 UploadedFileInterface instances.
* @return self
Expand All @@ -133,6 +143,8 @@ public function setUploadFileFactory(UploadedFileFactoryInterface $factory)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return null|UploadedFileFactoryInterface
*/
public function getUploadFileFactory()
Expand All @@ -141,6 +153,8 @@ public function getUploadFileFactory()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param bool $flag When true, this filter will use the $_FILES['name']
* as the target filename.
* Otherwise, it uses the default 'target' rules.
Expand All @@ -153,6 +167,8 @@ public function setUseUploadName($flag = true)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return bool
*/
public function getUseUploadName()
Expand All @@ -161,6 +177,8 @@ public function getUseUploadName()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param bool $flag When true, this filter will use the original file
* extension for the target filename
* @return self
Expand All @@ -172,6 +190,8 @@ public function setUseUploadExtension($flag = true)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return bool
*/
public function getUseUploadExtension()
Expand All @@ -180,6 +200,8 @@ public function getUseUploadExtension()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param bool $flag Shall existing files be overwritten?
* @return self
*/
Expand All @@ -190,6 +212,8 @@ public function setOverwrite($flag = true)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return bool
*/
public function getOverwrite()
Expand All @@ -198,6 +222,8 @@ public function getOverwrite()
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @param bool $flag Shall target files have a random postfix attached?
* @return self
*/
Expand All @@ -208,6 +234,8 @@ public function setRandomize($flag = true)
}

/**
* @deprecated Since 2.41.0. This method will be removed in 3.0 without replacement
*
* @return bool
*/
public function getRandomize()
Expand Down Expand Up @@ -251,6 +279,8 @@ public function filter($value)
}

/**
* @deprecated This method will be inaccessible in 3.0 once this class is marked final
*
* @param string $sourceFile Source file path
* @param string $targetFile Target file path
* @throws Exception\RuntimeException
Expand All @@ -273,6 +303,8 @@ protected function moveUploadedFile($sourceFile, $targetFile)
}

/**
* @deprecated This method will be inaccessible in 3.0 once this class is marked final
*
* @param string $targetFile Target file path
* @return void
* @throws Exception\InvalidArgumentException
Expand All @@ -293,6 +325,8 @@ protected function checkFileExists($targetFile)
}

/**
* @deprecated This method will be inaccessible in 3.0 once this class is marked final
*
* @param string $source
* @param string|null $clientFileName
* @return string
Expand Down Expand Up @@ -340,6 +374,8 @@ protected function getFinalTarget($source, $clientFileName)
}

/**
* @deprecated This method will be inaccessible in 3.0 once this class is marked final
*
* @param string $source
* @param string $filename
* @return string
Expand Down
Loading