The Messenger of Allah ﷺ said, speaking sternly about it, "Whoever swears by other than Allah..."
حدثنا عتاب حدثنا عبد الله أخبرنا موسى بن عقبة عن سالم
قال رسول الله ﷺ من حلف بغير الله فقال فيه قولا شديدا
No references are available.
Its isnad is sahih. It is an abridgment of 4904, and see 5256. As for his statement, "He said something severe about it," he means by it his statement in the preceding narration, "He has indeed committed shirk."