Put the flour and butter in a food processor and blitz to bread crumbs. If using your hands, rub the butter and flour together until the mixture resembles fine bread crumbs. Add the egg yolks (and if making sweet pastry, the sugar) and a pinch of salt and stir together with a knife. Squidge the mixture together into a ball. If the pastry feels very dry add the water (or if making sweet pastry, the cream or milk), but try and get by without for a more tender pastry.
Once the pastry is all squidged together, pop it in the refrigerator to rest for 30 minutes.
After 30 minutes, remove it from the refrigerator and let it warm up a little (if you use it straight from the refrigerator and try to roll it out, the pastry will just be a hopeless crumbly mess). Roll the pastry out on a lightly floured board and use as required.