01 - Preheat oven to 400°F. Line a baking sheet with parchment paper.
02 - Heat olive oil in a skillet over medium heat. Add chopped onion and minced garlic; cook until translucent, about 2 minutes.
03 - Add diced mushrooms to the skillet. Sauté until softened and all moisture has evaporated, about 5 minutes.
04 - Stir in chopped spinach and cook until wilted, approximately 2 minutes. Remove skillet from heat and allow mixture to cool slightly.
05 - Transfer vegetable mixture to a mixing bowl. Fold in ricotta cheese, Parmesan, dried thyme, salt, and black pepper until well blended.
06 - Unroll puff pastry on a lightly floured surface. Slice into 8 equal squares using a sharp knife.
07 - Place a generous spoonful of filling in the center of each pastry square. Fold into a triangle or rectangle, pressing the edges to seal tightly.
08 - Arrange filled pastries on prepared baking sheet. Lightly brush the tops with beaten egg using a pastry brush.
09 - Bake in the preheated oven for 20 to 25 minutes, or until golden brown and puffed.
10 - Allow pastries to cool slightly on the baking sheet before serving warm.