Modern PHP everybody.
>>101241434OOP syntax kills me on the inside
Who thought putting OOP and HTML templating engine together is a good idea?
>>101241434Looks fine
Is this bad in any other way than because it triggers your autism?
>>101241434>@>!=>no type annotationsNot modern, would not mergeModern PHP is still bad though
>>101241434What's the issue here? Code looks fine to me. Let me guess, the code is too complicated for your poo brain?
>>101241434>error suppression operators>equality operators instead of identicality operators>no typehinting for method arguments and return types>no null-safe operator>inappropriate array destructuring>no psr-compatible code style (2 spaces indents, no blank line before return statement)>two magic numbersYou still have much to learn, kiddo.
>>101241434How is 60000 one day? This PHPness confuses me.
>>101241434What the fuck is an auth()->factory()
>>101241550>no type annotationsthat's a good thing
>>101241434It's beautiful, isn't it?>>101241632I'd assume that's just milliseconds to minutes.
>>101241632The default TTL is 1/60000 of a day.
>>101241434should be respondWithToken(string $token, int $status = 200): JsonResponse {...}otherwise it looks good to me, better than jeetscripts framework
>>101241718it's `array $token` and that array needs to be typed with phpdoc
>>101241434Not bad to be honest.I've seen worse
>>101241550You can add type annonations by yourself, but it's not mandatory
>>101241779The language doesn't force you but you should do it anyway, there's negligible downside to just typing out array $token. Somebody in this thread already managed to get confused about which type it was supposed to beGetting it kitted up for phpstan (array{user: ...} etcetera) is more debatable but you should be doing this much at least
array $token
array{user: ...}
jizuz crust.. that looks awful. looks like Go-man or Rust-dude iterators ive seen beforesame extensive use of non-alphanumeric, control symbolics ?->but its not modern, modern according to PHP burocrats would be extremely dry single-liners single-spaghetties that look lone and empty. those imo are worse than this "rich" variant
>>101241434i took 2 years of web dev classes, so i really should know what any of that means, but i don't
>>101241673Looks like auth() instantiates an object and factory() is a method in that object.
>>101242046>but you should do it anywayit only helps if you wait to throw errors in case something goes wrong
>>101245644It also makes the code easier to read and it lets IDE features do their jobBut yeah, in general I do want to throw an error when something goes wrong
>>101241434There's absolutely nothing modern in your screenshot