Because Item::get() returns an instance of an Item, not an instance of the Durable class, where the setUnbreakable function is housed.
PHP: $item = Item::get(Item::WOODEN_SHOVEL);if($item instanceof Durable) { $item->setUnbreakable(); $player->getInventory()->setItem(0, $item);}
You're complicating it for yourself. Just know that Item::get() returns an Item, but by testing if it's also an instance of the Durable class, you get the methods that the Durable class has(i.e. the setUnbreakable() function) But the parent class of Durable is Item, so you'll have access to those methods too.
It should work if you're using the latest commit of Pocketmine. Here's to show the function exists: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/Durable.php#L43 Here's to show that it works: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/Durable.php#L53