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

Remove unused RedirectException and add some PHPDocs #1497

Merged
merged 1 commit into from
Nov 29, 2018

Conversation

natanfelles
Copy link
Contributor

Description

RedirectException never is thrown. Added some possible throwns.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

*/
public function getJSON()
{
$body = $this->body;

if ($this->bodyFormat !== 'json')
{
/**
* @var Format $config
*/
$config = config(Format::class);
$formatter = $config->getFormatter('application/json');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this file, in the line below, $formatter->format() is typed to expect an array.

public function format(array $data);

Removing the type hint in the FormatterInterface allow more flexibility to work with objects, like pass an \CodeIgniter\Entity directly.

The conversion could be done inside the method, if necessary:

$this->arrayToXML($data, $output);

JSONFormatter does not needs.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting idea, and I'm ok with that. You could easily check if it's an Entity and call it's toArray() method to get the values.

*/
public function deleteCookie($name = '', string $domain = '', string $path = '/', string $prefix = '')
{
if (empty($name))
{
return;
return $this;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allow fluent method continues to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the $name is empty. Should not delete all? - removing the default ''

@jim-parry jim-parry merged commit 540e94b into codeigniter4:develop Nov 29, 2018
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.

3 participants