Composer fails to download PHP Codesniffer to plugin

I managed to fix the error by updating openssl as @Sally Cj said. I was still using Mac OS El Capitan, so I tried the Homebrew method of updating it, but that didnt fix it.

I eventually ended up just upgrading to the latest “Mojave” OS version, and it works 100% now.

enter image description here