Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilan-riviere authored and github-actions[bot] committed Sep 12, 2023
1 parent c3139e4 commit 2aee8ce
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Commands/Commandable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function askOnProduction(Closure $closure = null, bool $with_force = true
$force = $this->option($option) ?? false;
}

if ('local' !== config('app.env') && ! $force) {
if (config('app.env') !== 'local' && ! $force) {
if ($this->confirm("You're on production, do you really want to continue?", true)) {
$this->info('Confirmed.');
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/TagCleanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public function handle()
foreach ($taggables as $row) {
$model = $row->taggable_type::find($row->taggable_id);

if (null === $model) {
if ($model === null) {
DB::table($taggables)->where('id', $row->id)->delete();
$this->warn("Deleted taggable entry: {$row->taggable_type} #{$row->taggable_id}");
}

$tag = DB::table('tags')->find($row->tag_id);

if (null === $tag) {
if ($tag === null) {
DB::table($taggables)->where('id', $row->id)->delete();
$this->warn("Deleted taggable entry: Tag #{$row->id}");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Engines/SearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
*/
public static function create(?string $q = '', bool $relevant = false, bool $opds = false, string|array $types = null): SearchEngine
{
if ('string' === gettype($types)) {
if (gettype($types) === 'string') {
$types = explode(',', $types);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Components/DescriptionInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static function make(
int $width = 1,
bool $required = false,
): Forms\Components\Textarea {
if (null === $helper && $metaField) {
if ($helper === null && $metaField) {
$transGenerate = __('steward::filament.form_helper.generate');
$transMetaField = __('steward::filament.form_helper.meta_description');
$onlyOn = __('steward::filament.form_helper.only_on');
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Components/NameInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function make(
int $width = 1,
bool $required = true,
): Forms\Components\TextInput {
if (null === $helper) {
if ($helper === null) {
$transGenerate = __('steward::filament.form_helper.generate');
$fieldName = __('steward::filament.form_helper.metalink').' '.__('steward::filament.form_helper.and').' '.__('steward::filament.form_helper.meta_title');

Expand Down
4 changes: 2 additions & 2 deletions src/Filament/Config/FilamentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function name(
int $width = 1,
bool $required = true,
) {
if (null === $helper) {
if ($helper === null) {
$transGenerate = __('steward::filament.form_helper.generate');
$fieldName = __('steward::filament.form_helper.metalink').' and '.__('steward::filament.form_helper.meta_title');

Expand Down Expand Up @@ -82,7 +82,7 @@ public static function description(
int $width = 1,
bool $required = false,
) {
if (null === $helper && $metaField) {
if ($helper === null && $metaField) {
$transGenerate = __('steward::filament.form_helper.generate');
$transMetaField = __('steward::filament.form_helper.meta_description');
$onlyOn = __('steward::filament.form_helper.only_on');
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Pages/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function mount(): void
{
parent::mount();

if ('local' === config('app.env')) {
if (config('app.env') === 'local') {
$this->form->fill([
'email' => config('app.admin.email'),
'password' => config('app.admin.password'),
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/ProcessFavicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private function setIcon(string $path)
return;
}

$is_svg = 'svg' === File::extension($path);
$is_svg = File::extension($path) === 'svg';

if ($is_svg) {
if (extension_loaded('imagick')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

class Submission extends Model
{
use HasFactory;
use HasAttachment;
use HasFactory;
use Mediable;

protected $fillable = [
Expand Down
1 change: 1 addition & 0 deletions src/Services/Datayable/DatayableService.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function merge(?array $json): array
}

$data = [];

/** @var DatayableItem $item */
foreach ($this->data as $key => $item) {
$is_array = false;
Expand Down
2 changes: 1 addition & 1 deletion src/Services/DirectoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private function parseDirectory(string $directory): Generator

if (! is_dir($path)) {
yield $path;
} elseif ('.' != $value && '..' != $value) {
} elseif ($value != '.' && $value != '..') {
yield from $this->parseDirectory($path);

yield $path;
Expand Down
3 changes: 2 additions & 1 deletion src/Services/Image/ColorThief.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ private function isTransparentType(): bool
private function handleGif(): mixed
{
$handle = imagecreatefromgif($this->image);

// IF IMAGE IS TRANSPARENT (alpha=127) RETURN fff FOR WHITE
if (127 == imagecolorsforindex($handle, imagecolorstotal($handle) - 1)['alpha']) {
if (imagecolorsforindex($handle, imagecolorstotal($handle) - 1)['alpha'] == 127) {
$this->useDefault = true;

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Services/MarkdownService.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private function getConfig(): Environment
'default_attributes' => [
Heading::class => [
'class' => static function (Heading $node) {
if (1 === $node->getLevel()) {
if ($node->getLevel() === 1) {
return 'title-main';
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/Services/OpenGraph/OpenGraphItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function checkUrl(): string

private function checkImage(): ?string
{
if (0 === strpos($this->image, '/')) {
if (strpos($this->image, '/') === 0) {
return "{$this->site_url}{$this->image}";
}

Expand Down
4 changes: 2 additions & 2 deletions src/Services/SlugService.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ private function setName(): string

private function unique(string $name = null, int $counter = 0): string
{
if (null === $name) {
if ($name === null) {
$name = uniqid();
}
$updated_name = 0 == $counter ? $name : $name.'-'.$counter;
$updated_name = $counter == 0 ? $name : $name.'-'.$counter;

if ($this->model->where($this->slugColumn, Str::slug($updated_name))->exists()) {
return $this->unique($name, $counter + 1);
Expand Down
3 changes: 2 additions & 1 deletion src/Services/WikipediaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,12 @@ private function setQueries(): Collection
}

$lang = $this->language;

// If language attribute is unknown, set it to english.
if ($this->languageAttribute && $this->attributeExistInModel($this->languageAttribute, $object)) {
$lang = $object->{$this->languageAttribute};

if ('unknown' === $lang || null === $lang) {
if ($lang === 'unknown' || $lang === null) {
$lang = $this->language;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getBuilderDataAttribute(): array
*/
private function checkArrayNested(mixed $array): mixed
{
if (is_array($array) && 1 === count($array) && array_key_exists(0, $array)) {
if (is_array($array) && count($array) === 1 && array_key_exists(0, $array)) {
return $array[0];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasGravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private function generateGravatar(string $email): string
public static function bootHasGravatar()
{
static::creating(function (Model $model) {
if (null === $model->{$model->getGravatarColumn()}) {
if ($model->{$model->getGravatarColumn()} === null) {
$model->{$model->getGravatarColumn()} = $model->generateGravatar($model->{$model->getGravatarEmailColumn()});
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getTemplateDataAttribute(): array
*/
private function checkArrayNested(mixed $array): mixed
{
if (is_array($array) && 1 === count($array) && array_key_exists(0, $array)) {
if (is_array($array) && count($array) === 1 && array_key_exists(0, $array)) {
return $array[0];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/LazyEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getLabel(): ?string
public static function getLocaleBaseName(): string
{
$class = new ReflectionClass(static::class);
$namespace = 'App\\Enums' === $class->getNamespaceName() ? '' : 'steward::';
$namespace = $class->getNamespaceName() === 'App\\Enums' ? '' : 'steward::';
$class = $class->getShortName();
$class_slug = Str::kebab($class);
$class_slug = str_replace('-enum', '', $class_slug);
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Mediable.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getMediableAttribute(): object
*/
public function mediable(string $field = 'picture', bool $usePath = false): string|array|null
{
if (null === $this->{$field}) {
if ($this->{$field} === null) {
return \Kiwilan\Steward\StewardConfig::mediableDefault();
}
$path = $usePath ? $field : $this->{$field};
Expand Down
2 changes: 1 addition & 1 deletion tests/Data/Exports/BookExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Maatwebsite\Excel\Concerns\WithMapping;
use Spatie\QueryBuilder\QueryBuilder;

class BookExport implements FromQuery, WithHeadings, WithMapping, ShouldAutoSize
class BookExport implements FromQuery, ShouldAutoSize, WithHeadings, WithMapping
{
use Exportable;

Expand Down
2 changes: 1 addition & 1 deletion tests/Data/Models/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Book extends Model
use HasSeo;
use HasSlug;
use HasTimeToRead;
use Queryable;
use Publishable;
use Queryable;

protected $slugColumn = 'slug_custom';

Expand Down

0 comments on commit 2aee8ce

Please sign in to comment.