driade / phpfmt8

PHP formatter for Sublime Text 4, with PHP 8 support.
BSD 3-Clause "New" or "Revised" License
46 stars 2 forks source link

There is an empty line after the inheritance namespace class #31

Closed glauca closed 1 year ago

glauca commented 1 year ago

before format

<?php

class Message extends App\Services\Kernel\Message
{

}

after format

<?php

class Message extends App\Services\Kernel\Message

{

}
driade commented 1 year ago

Thank you, fixed

glauca commented 1 year ago

before format

<?php

use RuntimeException;

class Message extends App\Services\Kernel\Message
{
    public function getOriginalAttributes(): array
    {
        $attributes = json_decode($this->getOriginalContents(), true);

        return is_array($attributes) ? $attributes : [];
    }

    public function getEventType(): ?string
    {
        $eventType = $this->getOriginalAttributes()['event_type'];

        if (!is_string($eventType)) {
            throw new RuntimeException('Invalid event type.');
        }

        return $eventType;
    }
}

after format

<?php

use RuntimeException;

class Message extends App\Services\Kernel\Message
{
    public function getOriginalAttributes(): array

{
        $attributes = json_decode($this->getOriginalContents(), true);

        return is_array($attributes) ? $attributes : [];
    }

    public function getEventType(): ?string
{
        $eventType = $this->getOriginalAttributes()['event_type'];

        if (!is_string($eventType)) {
            throw new RuntimeException('Invalid event type.');
        }

        return $eventType;
    }
}
driade commented 1 year ago

Thank you very much @glauca . I've reverted this commit until this is correctly fixed, and published it to Sublime.

driade commented 1 year ago

Here we go @glauca :)