mariosimao / notion-sdk-php

A complete Notion SDK for PHP developers.
https://mariosimao.github.io/notion-sdk-php/
MIT License
138 stars 24 forks source link

Just a bit confused, why return a new class instead of returning the object itself? Is there any specific consideration? #360

Closed yankewei closed 3 months ago

yankewei commented 3 months ago

https://github.com/mariosimao/notion-sdk-php/blob/a3d4c145c1705a5c5c24e3e5e93b45cc1f8cc130/src/Pages/Page.php#L173

mariosimao commented 3 months ago

To achieve immutability.

Reasoning: https://web.mit.edu/6.005/www/fa15/classes/09-immutability