src/Viserio/Component/Filesystem/Traits/FilesystemExtensionTrait.php
public function withoutExtension(string $path, string $extension = null): string
    {
        $path = $this->getTransformedPath($path);

        if ($extension !== null) {
            // remove extension and trailing dot
            return \rtrim(\basename($path, $extension), '.');
        }

        return \pathinfo($path, \PATHINFO_FILENAME);
    }
public function withoutExtension(string $path, string $extension = null): string
    {
        $path = $this->getTransformedPath($path);

        if ($extension !== null) {
            // remove extension and trailing dot
            return \rtrim(\basename($path, $extension), '.');
        }

        return \pathinfo($path, \PATHINFO_FILENAME);
    }
Returns the filename without the extension from a file path.

@param string      $path      The path string
@param null|string $extension If specified, only that extension is cut off
(may contain leading dot)

@return string Filename without extension