nkl-kst / the-sports-db

PHP library to get sports data from TheSportsDB (https://www.thesportsdb.com)
MIT License
22 stars 3 forks source link

Access name property before intialization in table entry #21

Closed nkl-kst closed 3 years ago

nkl-kst commented 3 years ago

See failed test.

1) LookupTest::testTable
Error: Typed property NklKst\TheSportsDb\Entity\Table\Entry::$name must not be accessed before initialization

/home/runner/work/the-sports-db/the-sports-db/test/integration/LookupTest.php:210
nkl-kst commented 3 years ago

The table entry properties seems to be updated.

Current properties in code:

namespace NklKst\TheSportsDb\Entity\Table;

class Entry
{
    public string $name;
    public int $teamid;
    public int $played;
    public int $goalsfor;
    public int $goalsagainst;
    public int $goalsdifference;
    public int $win;
    public int $draw;
    public int $lost;
    public int $total;
}

Current API result from https://www.thesportsdb.com/api/v1/json/1/lookuptable.php?l=4328&s=2018-2019:

{
    "idStanding": "244657",
    "intRank": "1",
    "idTeam": "133613",
    "strTeam": "Man City",
    "strTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/vwpvry1467462651.png/tiny",
    "idLeague": "4328",
    "strLeague": "English Premier League",
    "strSeason": "2018-2019",
    "strForm": "WWWWW",
    "strDescription": "Promotion - Champions League (Group Stage)",
    "intPlayed": "38",
    "intWin": "32",
    "intLoss": "4",
    "intDraw": "2",
    "intGoalsFor": "95",
    "intGoalsAgainst": "23",
    "intGoalDifference": "72",
    "intPoints": "98",
    "dateUpdated": "2021-05-19 09:52:19"
},
nkl-kst commented 3 years ago

Fixed by #23