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

[BUG] 3 errors in model file generation #1055

Open
Mosaab-Emam opened this issue Dec 21, 2022 · 0 comments · May be fixed by #1058
Open

[BUG] 3 errors in model file generation #1055

Mosaab-Emam opened this issue Dec 21, 2022 · 0 comments · May be fixed by #1058

Comments

@Mosaab-Emam
Copy link
Contributor

Looking at what gets generated in the Model file, I noticed 3 errors.

1. Double semi-colon

Here are the first 6 lines from Model file

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;; use Illuminate\Database\Eloquent\Factories\HasFactory;;

The 2nd and 3rd imports have repeated semi-colons at the end.

2. Incorrect spacing and new lines in top section

In the code block above we can also see some white space added before the keyword use, which should not be there.

We also see that two use statements are in the same line, which is incorrect and inconsistent with every other generated file, the white space before the second use should be replaced with \n.

Another \n should be added right after the second use statement, there is no new line between it and the line below (not an import).

3. Incorrect use of tabs inside model class

Here are the first few lines in the generated model class

 */class User extends Model
{
     use SoftDeletes;    use HasFactory;    public $table = 'users';

    public $fillable = [

Firstly, we can see there should be a \n before the class keyword, which is not present.

Secondly: the first 3 statements in the class are present on the same line, with tabs in place of new lines.

Thirdly: the aforementioned statements have white space before them that should not be present, clearly visible on use SoftDeletes;

@Mosaab-Emam Mosaab-Emam changed the title [Bug] 3 errors in model file generation [BUG] 3 errors in model file generation Dec 21, 2022
@Mosaab-Emam Mosaab-Emam linked a pull request Jan 8, 2023 that will close this issue
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 a pull request may close this issue.

1 participant