Problem/Motivation
The method is declared as:
> public function dumpToUri(string $data, string $file_extension, string $uri): string {
but there are several returns of FALSE, e.g.:
if (!file_exists($uri) && !$this->fileSystem->saveData($data, $uri, FileExists::Replace)) {
return FALSE;
}
Because this file is missing a use strict, it's presumably being cast to an empty string?
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #3
hoxton commentedThe dumpToUri seems to update the file content and returns the $uri which was given to it as parameter for no-error state.
I believe it would be ok to return boolean only for no-error and error state.
Comment #5
burcu.sogut@drupart.com.tr commentedOpened an MR. Without strict types, PHP converts the FALSE returns to an empty string. The MR returns an empty string explicitly and adds declare(strict_types=1) to AssetDumper.php. The interface documents the empty string on failure. Callers do not change: AssetControllerBase ignores the return value.
Changing the return type to string|false is an API change, so the MR does not do that.
The MR adds AssetDumperTest. With strict types and the old code, the failure test throws a TypeError.
Comment #7
smustgrave commentedSome issue here, this is reading like AI https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett...
Please disclose use of AI and make sure everything is reviewed.
Since the summary wasn't clear on a path forward moving to NW as good practice to have the summary filed out. Sections that don't apply can be left blank or add NA
Comment #8
joachim commented> Since the summary wasn't clear on a path forward moving to NW as good practice to have the summary filed out
I wasn't clear on the path forward because I'm not sure what it should be -- probably one for the component maintainer to decide.
Comment #9
smustgrave commentedGood idea!