Skip to content

Remove dependency on Nette\Http\Request#131

Merged
aleswita merged 3 commits intocontributte:masterfrom
delacry:runtime-fix
Oct 19, 2024
Merged

Remove dependency on Nette\Http\Request#131
aleswita merged 3 commits intocontributte:masterfrom
delacry:runtime-fix

Conversation

@delacry
Copy link
Copy Markdown
Contributor

@delacry delacry commented Oct 13, 2024

Hi, there was a problem when you try to use this exntesion with php runtimes like swoole/roadrunner/falconphp, because you can't have Nette Request object, but you need your own implementation of IRequest that will switch its variables and state between requests.

The problem wasn't only Header resolver itself, because if you are not using it, extension will try to create it in DI and it fails in constructor, so extension could not work at all, so I moved one method for resolving locale from Nette Request to Header resolver.

@aleswita
Copy link
Copy Markdown
Member

jelikoz nas to nezbavi zavislosti na Nette/Http, tak bych se asi nebal udelat neco takoveho

return (new Request(
	$this->httpRequest->getUrl(),
	headers: $this->httpRequest->getHeaders()
))->detectLanguage($langs);

nez kopirovat kod

@delacry
Copy link
Copy Markdown
Contributor Author

delacry commented Oct 15, 2024

Great, that looks better, I did it in one line because of come codesniffer errors (tabs were used): nevermind.. fixed.

45 | ERROR | [x] Multi-line function call not indented correctly; expected 8 spaces but found 12 (PSR2.Methods.FunctionCallSignature.Indent)
45 | ERROR | [x] Closing parenthesis of a multi-line function call must be on a line by itself (PSR2.Methods.FunctionCallSignature.CloseBracketLine)

@aleswita aleswita merged commit 6d3e42d into contributte:master Oct 19, 2024
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