stefangabos / world_countries

Constantly updated lists of world countries and their associated alpha-2, alpha-3 and numeric country codes as defined by the ISO 3166 standard, available in CSV, JSON , PHP, SQL and XML formats, in multiple languages and with national flags included; also available are the ISO 3166-2 codes of provinces/ states associated with the countries
http://stefangabos.github.io/world_countries/
Other
1.39k stars 378 forks source link

php - use return statement instead of assignment #58

Closed jacekkarczmarczyk closed 2 years ago

jacekkarczmarczyk commented 2 years ago

Hopefully code samples explain all ;)

Current

require '...../world.php'; // $world = [...]

// where the heck the $world variable is coming from? phpstan/psalm/editor complains about undefined variable
print_r($world); 

Proposal

$world = require '...../world.php'; // return [...]

// all is well
print_r($world); 
stefangabos commented 2 years ago

i'll think about it and see what the best solution is thank you!

stefangabos commented 2 years ago

This is now done $world = require '...../world.php'; now works as you'd expect. Thanks for suggesting this!

jacekkarczmarczyk commented 2 years ago

it seems that this change is not included in 2.4.0 release although the README is already updated to the new format?

EDIT: nvm, I've just seen 2.5.0 in changelog

stefangabos commented 2 years ago

i haven't done a release yet containing the change - you'll have to download latest by clicking on the green "Code" button and then choosing "Download as ZIP". I am making some updates these days and I'll probably make a release next week

stefangabos commented 2 years ago

I forgot to add your name to the changelog - i just fixed that. thanks again!