I kinda thought the opposite...
By issuing his warning, he's making sure Russia and Syria can move all their valuable targets somewhere safe. Trump looks "tough" but whatever attacks he launches don't really have any effect.
That would require Trump actually thought about his Tweets, something we have no evidence he does no matter how many right-wingers on TV pretend there is some master plan with every one of Trump's actions.
They are poor impulse control Tweets, every one of them.
So, a more likely scenario: Trump had a frustrating week. The Syrian gas attack gave him a chance to act all presidently, and he could remind people Obama failed where braggadocios Trump was big and tough.
But it doesn't suit him to wait until an action is taken, he can't wait.
So the Tweet was a means of Trump saying
I'm going to act.
Then he got feedback, he said he wouldn't reveal such things ahead of time: many clips were played of him saying that; news media interviewed people responsible for the military action and they were caught off-guard.
Whoops! Trumpy goes into repair/rationalize mode and Tweets he wasn't really giving plans away. Trump changes his brain narrative, he was always on top of this, only fake news said he wasn't.