TGViewer
Пых Пых @phpyh · 7.83K subscribers
Post #73 1.8K
В Psalm скоро появятся условные типы как в TypeScript.
/**
* @template T as string|list<string>
* @psalm-param T $name
* @psalm-return (T is string ? Connection : array<string, Connection>)
*/
public function getConnection($name) {
// ...
}


Поиграться можно тут: https://psalm.dev/r/5fb0ea4228 .
Источник: https://twitter.com/psalmphp/status/1241744682494971904 .
Подробнее в issue: https://github.com/vimeo/psalm/issues/3005 .
Twitter Psalm Quarantine update: was bored, so decided to implement TypeScript's conditional types in Psalm. You can play with the prototype here: https://t.co/Roc7rm90Ao
More from @phpyh
  1. Sep 30, 2026🍺 BeerPHP AI Moscow Кажется, «неделя PHP» потихоньку превращается в месяц PHP. 😅 Будет 2…
  2. Sep 28, 2026Запустили Пыхник и неделю PHP! Залетайте на первый открытый доклад от Дмитрия Dantes про к…
  3. Sep 15, 2026Сейчас один человек с AI может выполнять работу целого IT-отдела. Только хуёво
  4. Sep 12, 2026Спасибо за заявки! Всем напишу в понедельник. Осталось 1 место.
  5. Sep 11, 2026Хардкорный курс асинхронного PHP https://hardcourse.ru/php/async
  6. Sep 11, 2026Ещё полчасика надо — сайт готов, расписываю программу! 🙏
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →