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

Change RequestInterface::getCurlPostFields() return type from ?array to array #92

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Sep 2, 2024

Technically a BC break, but only if you created your own Request class, so low chance

@OskarStark OskarStark changed the title Change RequestInterface::getCurlPostFields() return type from `?arr… Change RequestInterface::getCurlPostFields() return type from ?array to array Sep 2, 2024
Comment on lines -46 to -50
#[Depends('testCanBeCrated')]
public function testGetCurlPostFields(Request $request): void
{
$this->assertIsArray($request->getCurlPostFields());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore, at is always an array

@OskarStark OskarStark force-pushed the feature/better-return-type branch from 0e33d8b to dd3f3ee Compare September 3, 2024 07:25
*/
public function __construct(
private readonly string $apiUrl,
private readonly string $method,
private readonly ?array $curlPostFields = null,
private readonly ?array $curlPostFields = [],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here no need for ?, just array?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can review all instances of $request = new Request($client->buildApiUrl(), Request::GET); and add [] as a third argument?

Copy link
Contributor Author

@OskarStark OskarStark Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here no need for ?, just array?

Good catch

Maybe we can review all instances of $request = new Request($client->buildApiUrl(), Request::GET); and add [] as a third argument?

We can, but I would not, we need to keep the default value anyway, otherwise it is a BC break

…ay` to `array`

Technically a BC break, but only if you created your own `Request` class, so low chance
@OskarStark OskarStark force-pushed the feature/better-return-type branch from dd3f3ee to 92216ac Compare September 3, 2024 10:47
Copy link
Owner

@slunak slunak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@slunak slunak merged commit 95c30ab into slunak:master Sep 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants