Skip to content

scoper-autoload.php using class_exists for scoped interfaces #403

Closed
@jarrodbell

Description

@jarrodbell

Bug report

Question Answer
Box version 0.13.3
PHP version 7.2.29
Platform with version MacOS

scoped output of vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php

<?php

namespace MyNamespace;

interface SessionUpdateTimestampHandlerInterface
{
    /**
     * Checks if a session identifier already exists or not.
     *
     * @param string $key
     *
     * @return bool
     */
    public function validateId($key);
    /**
     * Updates the timestamp of a session when its data didn't change.
     *
     * @param string $key
     * @param string $val
     *
     * @return bool
     */
    public function updateTimestamp($key, $val);
}
\class_alias('MyNamespace\\SessionUpdateTimestampHandlerInterface', 'SessionUpdateTimestampHandlerInterface', \false);

scoper-autoload.php contains the following snippet:

if (!class_exists('SessionUpdateTimestampHandlerInterface', false)) {
    class_exists('MyNamespace\SessionUpdateTimestampHandlerInterface');
}

The above results in an error:

Cannot declare interface SessionUpdateTimestampHandlerInterface, because the name is already in use

vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php:25
class_alias()
vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php:25
Composer\A\includeFile()
vendor/composer/ClassLoader.php:322
Composer\A\ClassLoader->loadClass()
Unknown location
spl_autoload_call()
Unknown location
class_exists('MyNamespace\SessionUpdateTimestampHandlerInterface')
vendor/scoper-autoload.php:25

If I change the scoper-autoload.php snippet above to the following instead, the error is gone:

if (!interface_exists('SessionUpdateTimestampHandlerInterface', false)) {
    interface_exists('MyNamespace\SessionUpdateTimestampHandlerInterface');
}

Is there something I am missing to make sure scoper-autoload.php correctly uses interface_exists for Interfaces?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions