Error with endsWith property

It’s not a real error, just wrong IDE indication.
You can leave it as is (or define the @type of the value parameter in case you want to stop seeing it).