Skip to content

fix(php): native return types for AbstractModel methods #3563

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

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class AbstractModel
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
Expand All @@ -32,7 +32,7 @@ public function __toString()
* @return mixed returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
Expand All @@ -42,7 +42,7 @@ public function jsonSerialize()
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
Expand Down
1 change: 1 addition & 0 deletions config/generation.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const patterns = [
'!clients/algoliasearch-client-php/**',
'clients/algoliasearch-client-php/lib/Api/*',
'clients/algoliasearch-client-php/lib/Model/**',
'!clients/algoliasearch-client-php/lib/Model/AbstractModel.php',
'clients/algoliasearch-client-php/lib/Configuration/*',
'clients/algoliasearch-client-php/lib/ApiException.php',
'clients/algoliasearch-client-php/lib/ObjectSerializer.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void processOpts() {
supportingFiles.removeIf(file -> file.getTemplateFile().equals(".php-cs-fixer.php"));
supportingFiles.removeIf(file -> file.getTemplateFile().equals(".php-cs-fixer.dist.php"));
supportingFiles.removeIf(file -> file.getTemplateFile().equals("phpunit.xml.mustache"));
supportingFiles.removeIf(file -> file.getTemplateFile().equals("AbstractModel.php"));

supportingFiles.add(new SupportingFile("Configuration.mustache", "lib/Configuration", "Configuration.php"));
supportingFiles.add(new SupportingFile("ConfigWithRegion.mustache", "lib/Configuration", "ConfigWithRegion.php"));
Expand Down
Loading