01 - Preheat oven to 400°F. Line a baking sheet with parchment paper.
02 - Heat olive oil in a skillet over medium heat. Add onions and garlic; cook until translucent, about 2 minutes.
03 - Add mushrooms and sauté until softened and moisture evaporates, about 5 minutes.
04 - Stir in chopped spinach and cook until wilted, about 2 minutes. Remove from heat and let mixture cool slightly.
05 - In a mixing bowl, combine sautéed vegetables with ricotta cheese, Parmesan, dried thyme, salt, and black pepper. Mix until evenly incorporated.
06 - Unroll puff pastry sheet on a lightly floured surface. Cut into 8 equal squares.
07 - Place a generous spoonful of the filling in the center of each square. Fold pastry into a triangle or rectangle and firmly seal the edges.
08 - Arrange filled pastries on the prepared baking sheet. Brush tops with beaten egg for a golden finish.
09 - Bake for 20 to 25 minutes, or until pastries are golden brown and puffed.
10 - Allow pastries to cool slightly before serving warm.