Nolan81 Posted December 10, 2023 Share Posted December 10, 2023 https://github.com/pheroh/TSP-GA-PHP need this lib for my lab , is there a way to automatically upgrade it to modern php8 version? Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/ Share on other sites More sharing options...
requinix Posted December 10, 2023 Share Posted December 10, 2023 Have you tried running it? Does it work? Are there any errors? Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613439 Share on other sites More sharing options...
Nolan81 Posted December 10, 2023 Author Share Posted December 10, 2023 running is not enough. Code will be watched by teacher, code should not be that old looking Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613440 Share on other sites More sharing options...
requinix Posted December 10, 2023 Share Posted December 10, 2023 Your teacher is going to grade you on the quality of someone else's library? What? It doesn't look old. It's not like PHP 8 introduced some incredibly obvious and immensely helpful features that everybody had to stop what they were doing and migrate to using. Like, unless I were to look over it with a fine-toothed comb, I don't think I could tell you whether it was written for PHP 5 or PHP 8. But no, there aren't really any tools to do what you want automatically. Not that I know of. But the project isn't that large - it should only take, like maybe, 15 minutes if you wanted to "spruce it up" or something. Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613444 Share on other sites More sharing options...
Barand Posted December 10, 2023 Share Posted December 10, 2023 One thing to watch for is the stricter variable typing in version 8. Whereas in earlier versions this would work (the empty string being treated as "0") ... $a = 5; $b = ''; echo $a + $b; in version 8 it throws an error Quote PHP Fatal error: Uncaught TypeError: Unsupported operand types: int + string in ..... Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613447 Share on other sites More sharing options...
kicken Posted December 11, 2023 Share Posted December 11, 2023 12 hours ago, requinix said: But no, there aren't really any tools to do what you want automatically. Not that I know of. I've never used it personally but I've heard good things about rector. 2 Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613460 Share on other sites More sharing options...
Nolan81 Posted December 11, 2023 Author Share Posted December 11, 2023 rector is what chatgpt proposed too. 17 hours ago, requinix said: Like, unless I were to look over it with a fine-toothed comb, I don't think I could tell you whether it was written for PHP 5 or PHP 8 missing types of the arguments, properties is obvious sign. or code like : = array() Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613464 Share on other sites More sharing options...
requinix Posted December 11, 2023 Share Posted December 11, 2023 1 hour ago, Nolan81 said: missing types of the arguments, properties is obvious sign. or code like : = array() Casual code doesn't always use types. And there are people who find "array" to be easier to scan and read than brackets. Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613466 Share on other sites More sharing options...
gizmola Posted December 11, 2023 Share Posted December 11, 2023 I looked at the code, and it's fine. As others said, I'm not sure why it matters, if you are planning to use this as the basis for a project of your own, unless you are planning to try and pass the code off as something you wrote yourself. Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613488 Share on other sites More sharing options...
Nolan81 Posted December 12, 2023 Author Share Posted December 12, 2023 (edited) I will need to use any of such swarm libraries as a basis for my own tasks, they do not perform them, they concentrate on TSP. Edited December 12, 2023 by Nolan81 Quote Link to comment https://forums.phpfreaks.com/topic/317525-how-hard-would-it-be-to-move-it-to-php8/#findComment-1613494 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.