vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

UndefinedMethod on extended class from vendor #1486

Closed narekmarkosyan closed 5 years ago

narekmarkosyan commented 5 years ago

Vendor folder is in ignore list, but i have class that extended from it.

class ClassFromVendor{
     public function foo(){
     }
}

class MyClass extends ClassFromVendor{
}

$my = new MyClass();
$my->foo(); // i got UndefinedMethod on this

Is there any way to ignore check on vendor but still import code from it? Or duplicating methods and returning parent is only way?

muglug commented 5 years ago

Psalm should definitely see that without a problem - is the extended class publicly-available?

narekmarkosyan commented 5 years ago

Thanks for fast reply!

use PhpOffice\PhpWord\TemplateProcessor;

class WordTemplateProcessor extends TemplateProcessor{}

This is my code. But now i tried to extend different lib from vendor and got same result.

My psalm.xml, maybe it will help.

<?xml version="1.0"?>
<psalm
    totallyTyped="false"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config file:///home/narek/workspace/static_psalm_analysis/vendor/vimeo/psalm/config.xsd"
>
    <projectFiles>
        <directory name="/home/narek/workspace/taxiserv" />
        <ignoreFiles>
            <directory name="/full/path/to/vendor"/>
        </ignoreFiles>
    </projectFiles>

    <issueHandlers>
        <AbstractInstantiation errorLevel="error"/>
        <AssignmentToVoid errorLevel="error"/>
        <ConflictingReferenceConstraint errorLevel="error"/>
        <CircularReference errorLevel="error"/>
        <ContinueOutsideLoop errorLevel="error"/>
        <DuplicateClass errorLevel="error"/>
        <DuplicateFunction errorLevel="error"/>
        <DuplicateMethod errorLevel="error"/>
        <DuplicateParam errorLevel="error"/>
        <ForbiddenEcho errorLevel="error"/>
        <ImplementedReturnTypeMismatch errorLevel="error"/>
        <InaccessibleClassConstant errorLevel="error"/>
        <InaccessibleMethod errorLevel="error"/>
        <InterfaceInstantiation errorLevel="error"/>
        <InaccessibleProperty errorLevel="error"/>
        <InternalClass errorLevel="error"/>
        <InternalMethod errorLevel="error"/>
        <InternalProperty errorLevel="error"/>
        <InvalidCast errorLevel="error"/>
        <InvalidFunctionCall errorLevel="error"/>
        <InvalidGlobal errorLevel="error"/>
        <InvalidPropertyAssignment errorLevel="error"/>
        <InvalidStaticInvocation errorLevel="error"/>
        <InvalidThrow errorLevel="error"/>
        <InvalidToString errorLevel="error"/>
        <NonStaticSelfCall errorLevel="error"/>
        <NullFunctionCall errorLevel="error"/>
        <NullIterator errorLevel="error"/>
        <NullOperand errorLevel="error"/>
        <NullPropertyAssignment errorLevel="error"/>
        <NullPropertyFetch errorLevel="error"/>
        <InvalidMethodCall errorLevel="error"/>
        <NullReference errorLevel="error"/>
        <OverriddenMethodAccess errorLevel="error"/>
        <OverriddenPropertyAccess errorLevel="error"/>
        <UndefinedInterfaceMethod errorLevel="error"/>
        <InvalidCatch errorLevel="error"/>

        <LoopInvalidation errorLevel="suppress"/>
        <ForbiddenCode errorLevel="suppress"/>
        <InvalidIterator errorLevel="suppress"/>
        <DuplicateArrayKey errorLevel="suppress"/>
        <InvalidParamDefault errorLevel="suppress"/>
        <ImplicitToStringCast errorLevel="suppress"/>
        <EmptyArrayAccess errorLevel="suppress"/>
        <DeprecatedClass errorLevel="suppress"/>
        <DeprecatedConstant errorLevel="suppress"/>
        <DeprecatedInterface errorLevel="suppress"/>
        <InvalidClone errorLevel="suppress"/>
        <DeprecatedMethod errorLevel="suppress"/>
        <DeprecatedProperty errorLevel="suppress"/>
        <DeprecatedTrait errorLevel="suppress"/>
        <FalsableReturnStatement errorLevel="suppress"/>
        <FalseOperand errorLevel="suppress"/>
        <InvalidArgument errorLevel="suppress"/>
        <InvalidArrayAccess errorLevel="suppress"/>
        <InvalidArrayOffset errorLevel="suppress"/>
        <InvalidClass errorLevel="suppress"/>
        <InvalidStringClass errorLevel="suppress"/>
        <InvalidDocblock errorLevel="suppress"/>
        <InvalidFalsableReturnType errorLevel="suppress"/>
        <InvalidNullableReturnType errorLevel="suppress"/>
        <InvalidOperand errorLevel="suppress"/>
        <InvalidPassByReference errorLevel="suppress"/>
        <InvalidPropertyAssignmentValue errorLevel="suppress"/>
        <InvalidPropertyFetch errorLevel="suppress"/>
        <InvalidReturnStatement errorLevel="suppress"/>
        <InvalidReturnType errorLevel="suppress"/>
        <InvalidScalarArgument errorLevel="suppress"/>
        <InvalidScope errorLevel="suppress"/>
        <InvalidTemplateParam errorLevel="suppress"/>
        <InvalidThrow errorLevel="suppress"/>
        <LessSpecificImplementedReturnType errorLevel="suppress"/>
        <LessSpecificReturnStatement errorLevel="suppress"/>
        <LessSpecificReturnType errorLevel="suppress"/>
        <MethodSignatureMismatch errorLevel="suppress"/>
        <MethodSignatureMustOmitReturnType errorLevel="suppress"/>
        <MismatchingDocblockParamType errorLevel="suppress"/>
        <MismatchingDocblockReturnType errorLevel="suppress"/>
        <MismatchingDocblockParamType errorLevel="suppress"/>
        <MisplacedRequiredParam errorLevel="suppress"/>
        <MissingClosureParamType errorLevel="suppress"/>
        <MissingClosureReturnType errorLevel="suppress"/>
        <MissingConstructor errorLevel="suppress"/>
        <MissingDependency errorLevel="suppress"/>
        <MissingDocblockType errorLevel="suppress"/>
        <MissingFile errorLevel="suppress"/>
        <MissingParamType errorLevel="suppress"/>
        <MissingPropertyType errorLevel="suppress"/>
        <MissingReturnType errorLevel="suppress"/>
        <MissingTemplateParam errorLevel="suppress"/>
        <MissingThrowsDocblock errorLevel="suppress"/>
        <MixedArgument errorLevel="suppress"/>
        <MixedArrayAccess errorLevel="suppress"/>
        <MixedArrayAssignment errorLevel="suppress"/>
        <MixedArrayOffset errorLevel="suppress"/>
        <MixedAssignment errorLevel="suppress"/>
        <MixedInferredReturnType errorLevel="suppress"/>
        <MixedMethodCall errorLevel="suppress"/>
        <MixedOperand errorLevel="suppress"/>
        <MixedPropertyAssignment errorLevel="suppress"/>
        <MixedPropertyFetch errorLevel="suppress"/>
        <MixedReturnStatement errorLevel="suppress"/>
        <MixedStringOffsetAssignment errorLevel="suppress"/>
        <MixedTypeCoercion errorLevel="suppress"/>
        <MoreSpecificImplementedParamType errorLevel="suppress"/>
        <MoreSpecificReturnType errorLevel="suppress"/>
        <NoValue errorLevel="suppress"/>
        <NoInterfaceProperties errorLevel="suppress"/>
        <NonStaticSelfCall errorLevel="suppress"/>
        <NullableReturnStatement errorLevel="suppress"/>
        <NullArgument errorLevel="suppress"/>
        <NullArrayAccess errorLevel="suppress"/>
        <NullArrayOffset errorLevel="suppress"/>
        <ParadoxicalCondition errorLevel="suppress"/>
        <ParentNotFound errorLevel="suppress"/>
        <PossiblyFalseArgument errorLevel="suppress"/>
        <PossiblyFalseIterator errorLevel="suppress"/>
        <PossiblyFalseOperand errorLevel="suppress"/>
        <PossiblyFalsePropertyAssignmentValue errorLevel="suppress"/>
        <PossiblyFalseReference errorLevel="suppress"/>
        <PossiblyInvalidArgument errorLevel="suppress"/>
        <PossiblyInvalidArrayAccess errorLevel="suppress"/>
        <PossiblyInvalidArrayAssignment errorLevel="suppress"/>
        <PossiblyInvalidArrayOffset errorLevel="suppress"/>
        <PossiblyInvalidFunctionCall errorLevel="suppress"/>
        <PossiblyInvalidIterator errorLevel="suppress"/>
        <PossiblyInvalidMethodCall errorLevel="suppress"/>
        <PossiblyInvalidOperand errorLevel="suppress"/>
        <PossiblyInvalidPropertyAssignment errorLevel="suppress"/>
        <PossiblyInvalidPropertyAssignmentValue errorLevel="suppress"/>
        <PossiblyInvalidPropertyFetch errorLevel="suppress"/>
        <PossiblyNullArgument errorLevel="suppress"/>
        <PossiblyNullArrayAccess errorLevel="suppress"/>
        <PossiblyNullArrayAssignment errorLevel="suppress"/>
        <PossiblyNullArrayOffset errorLevel="suppress"/>
        <PossiblyNullFunctionCall errorLevel="suppress"/>
        <PossiblyNullIterator errorLevel="suppress"/>
        <PossiblyNullOperand errorLevel="suppress"/>
        <PossiblyNullPropertyAssignment errorLevel="suppress"/>
        <PossiblyNullPropertyAssignmentValue errorLevel="suppress"/>
        <PossiblyNullPropertyFetch errorLevel="suppress"/>
        <PossiblyNullReference errorLevel="suppress"/>
        <PossiblyUndefinedArrayOffset errorLevel="suppress"/>
        <PossiblyUndefinedGlobalVariable errorLevel="suppress"/>
        <PossiblyUndefinedMethod errorLevel="suppress"/>
        <PossiblyUndefinedVariable errorLevel="suppress"/>
        <PossiblyUnusedParam errorLevel="suppress"/>
        <PossiblyUnusedMethod errorLevel="suppress"/>
        <PossiblyUnusedProperty errorLevel="suppress"/>
        <PropertyNotSetInConstructor errorLevel="suppress"/>
        <RawObjectIteration errorLevel="suppress"/>
        <RedundantCondition errorLevel="suppress"/>
        <RedundantConditionGivenDocblockType errorLevel="suppress"/>
        <ReferenceConstraintViolation errorLevel="suppress"/>
        <ReservedWord errorLevel="suppress"/>
        <TooFewArguments errorLevel="suppress"/>
        <TooManyArguments errorLevel="suppress"/>
        <TooManyTemplateParams errorLevel="suppress"/>
        <TypeCoercion errorLevel="suppress"/>
        <TypeDoesNotContainNull errorLevel="suppress"/>
        <TypeDoesNotContainType errorLevel="suppress"/>
        <UndefinedConstant errorLevel="suppress"/>
        <UndefinedGlobalVariable errorLevel="suppress"/>
        <UndefinedClass errorLevel="suppress"/>
        <UndefinedPropertyAssignment errorLevel="suppress"/>
        <UndefinedPropertyFetch errorLevel="suppress"/>
        <UndefinedThisPropertyAssignment errorLevel="suppress"/>
        <UndefinedThisPropertyFetch errorLevel="suppress"/>
        <UndefinedTrait errorLevel="suppress"/>
        <UndefinedVariable errorLevel="suppress"/>
        <UnevaluatedCode errorLevel="suppress"/>
        <UnimplementedAbstractMethod errorLevel="suppress"/>
        <UnimplementedInterfaceMethod errorLevel="suppress"/>
        <UnrecognizedExpression errorLevel="suppress"/>
        <UnrecognizedStatement errorLevel="suppress"/>
        <UnresolvableInclude errorLevel="suppress"/>
        <UnusedClass errorLevel="suppress"/>
        <UnusedMethod errorLevel="suppress"/>
        <UnusedParam errorLevel="suppress"/>
        <UnusedProperty errorLevel="suppress"/>
        <UnusedVariable errorLevel="suppress"/>
        <DocblockTypeContradiction errorLevel="suppress"/>
    </issueHandlers>

    <stubs>
        <file name="stubs/helpers.php"/>
        <file name="stubs/guzzle_http.php"/>
        <file name="stubs/ctype/ctype.php"/>
        <file name="stubs/pdo_ibm/pdo_ibm.php"/>
        <file name="stubs/sybase/sybase_ct.php"/>
        <file name="stubs/Parle/ParserException.php"/>
        <file name="stubs/Parle/Token.php"/>
        <file name="stubs/Parle/Parser.php"/>
        <file name="stubs/Parle/LexerException.php"/>
        <file name="stubs/Parle/ErrorInfo.php"/>
        <file name="stubs/Parle/RLexer.php"/>
        <file name="stubs/Parle/Stack.php"/>
        <file name="stubs/Parle/Lexer.php"/>
        <file name="stubs/Parle/RParser.php"/>
        <file name="stubs/svn/svn.php"/>
        <file name="stubs/gmp/gmp.php"/>
        <file name="stubs/posix/posix.php"/>
        <file name="stubs/SPL/SPL.php"/>
        <file name="stubs/SPL/SPL_c1.php"/>
        <file name="stubs/SPL/SPL_f.php"/>
        <file name="stubs/ftp/ftp.php"/>
        <file name="stubs/uopz/uopz.php"/>
        <file name="stubs/ffmpeg/ffmpeg.php"/>
        <file name="stubs/LevelDB/LevelDB.php"/>
        <file name="stubs/msgpack/msgpack.php"/>
        <file name="stubs/win32service/win32service.php"/>
        <file name="stubs/xdebug/xdebug.php"/>
        <file name="stubs/ibm_db2/ibm_db2.php"/>
        <file name="stubs/password/password.php"/>
        <file name="stubs/imap/imap.php"/>
        <file name="stubs/calendar/calendar.php"/>
        <file name="stubs/pspell/pspell.php"/>
        <file name="stubs/oauth/oauth.php"/>
        <file name="stubs/Core/Core_d.php"/>
        <file name="stubs/Core/Core_c.php"/>
        <file name="stubs/Core/Core.php"/>
        <file name="stubs/pdo_sqlite/pdo_sqlite.php"/>
        <file name="stubs/snmp/snmp.php"/>
        <file name="stubs/ncurses/ncurses.php"/>
        <file name="stubs/libxml/libxml.php"/>
        <file name="stubs/sysvshm/sysvshm.php"/>
        <file name="stubs/gearman/gearman.php"/>
        <file name="stubs/sockets/sockets.php"/>
        <file name="stubs/wddx/wddx.php"/>
        <file name="stubs/superglobals/_superglobals.php"/>
        <file name="stubs/ming/ming.php"/>
        <file name="stubs/iconv/iconv.php"/>
        <file name="stubs/apc/apc.php"/>
        <file name="stubs/xhprof/xhprof.php"/>
        <file name="stubs/mailparse/mailparse.php"/>
        <file name="stubs/sysvmsg/sysvmsg.php"/>
        <file name="stubs/intl/IntlChar.php"/>
        <file name="stubs/intl/intl.php"/>
        <file name="stubs/grpc/grpc.php"/>
        <file name="stubs/hash/hash.php"/>
        <file name="stubs/rrd/rrd.php"/>
        <file name="stubs/apcu/apcu.php"/>
        <file name="stubs/redis/Redis.php"/>
        <file name="stubs/redis/RedisCluster.php"/>
        <file name="stubs/xmlwriter/xmlwriter.php"/>
        <file name="stubs/zend/zend.php"/>
        <file name="stubs/zend/zend_f.php"/>
        <file name="stubs/zend/zend_d.php"/>
        <file name="stubs/sysvsem/sysvsem.php"/>
        <file name="stubs/dba/dba.php"/>
        <file name="stubs/ldap/ldap.php"/>
        <file name="stubs/tokenizer/tokenizer.php"/>
        <file name="stubs/v8js/v8js.php"/>
        <file name="stubs/mysql_xdevapi/mysql_xdevapi.php"/>
        <file name="stubs/Ev/Ev.php"/>
        <file name="stubs/date/date.php"/>
        <file name="stubs/date/date_c.php"/>
        <file name="stubs/date/date_d.php"/>
        <file name="stubs/readline/readline.php"/>
        <file name="stubs/sqlsrv/sqlsrv.php"/>
        <file name="stubs/Zend OPcache/OPcache.php"/>
        <file name="stubs/ssh2/ssh2.php"/>
        <file name="stubs/Phar/Phar.php"/>
        <file name="stubs/tests/StubsTest.php"/>
        <file name="stubs/tests/TestData/Providers/PhpStormStubsSingleton.php"/>
        <file name="stubs/tests/TestData/Providers/ReflectionTestDataProviders.php"/>
        <file name="stubs/tests/TestData/Providers/StubsTestDataProviders.php"/>
        <file name="stubs/tests/Parsers/Visitors/ASTVisitor.php"/>
        <file name="stubs/tests/Parsers/Visitors/ParentConnector.php"/>
        <file name="stubs/tests/Parsers/PHPReflectionParser.php"/>
        <file name="stubs/tests/Parsers/StubsParserErrorHandler.php"/>
        <file name="stubs/tests/Parsers/DocFactoryProvider.php"/>
        <file name="stubs/tests/Parsers/StubParser.php"/>
        <file name="stubs/tests/Parsers/Utils.php"/>
        <file name="stubs/tests/Parsers/ExpectedFunctionArgumentsInfo.php"/>
        <file name="stubs/tests/Parsers/MetaExpectedArgumentsCollector.php"/>
        <file name="stubs/tests/Model/BasePHPClass.php"/>
        <file name="stubs/tests/Model/PHPDefineConstant.php"/>
        <file name="stubs/tests/Model/PHPClass.php"/>
        <file name="stubs/tests/Model/PHPConst.php"/>
        <file name="stubs/tests/Model/PHPDocElement.php"/>
        <file name="stubs/tests/Model/StubsContainer.php"/>
        <file name="stubs/tests/Model/PHPParameter.php"/>
        <file name="stubs/tests/Model/PHPMethod.php"/>
        <file name="stubs/tests/Model/BasePHPElement.php"/>
        <file name="stubs/tests/Model/PHPFunction.php"/>
        <file name="stubs/tests/Model/PHPInterface.php"/>
        <file name="stubs/tests/Model/StubProblemType.php"/>
        <file name="stubs/tests/StubsMetaExpectedArgumentsTest.php"/>
        <file name="stubs/PDO/PDO.php"/>
        <file name="stubs/fpm/fpm.php"/>
        <file name="stubs/meta/.phpstorm.meta.php"/>
        <file name="stubs/geoip/geoip.php"/>
        <file name="stubs/amqp/amqp.php"/>
        <file name="stubs/judy/judy.php"/>
        <file name="stubs/bz2/bz2.php"/>
        <file name="stubs/recode/recode.php"/>
        <file name="stubs/SQLite/SQLite.php"/>
        <file name="stubs/inotify/inotify.php"/>
        <file name="stubs/cubrid/cubrid.php"/>
        <file name="stubs/soap/soap.php"/>
        <file name="stubs/rar/rar.php"/>
        <file name="stubs/regex/ereg.php"/>
        <file name="stubs/zlib/zlib.php"/>
        <file name="stubs/gmagick/gmagick.php"/>
        <file name="stubs/mongodb/mongodb.php"/>
        <file name="stubs/xml/xml.php"/>
        <file name="stubs/radius/radius.php"/>
        <file name="stubs/solr/functions.php"/>
        <file name="stubs/solr/Responses/SolrResponse.php"/>
        <file name="stubs/solr/Responses/SolrPingResponse.php"/>
        <file name="stubs/solr/Responses/SolrGenericResponse.php"/>
        <file name="stubs/solr/Responses/SolrUpdateResponse.php"/>
        <file name="stubs/solr/Responses/SolrQueryResponse.php"/>
        <file name="stubs/solr/Queries/SolrDisMaxQuery.php"/>
        <file name="stubs/solr/Queries/SolrQuery.php"/>
        <file name="stubs/solr/Queries/SolrParams.php"/>
        <file name="stubs/solr/Queries/SolrModifiableParams.php"/>
        <file name="stubs/solr/Queries/SolrCollapseFunction.php"/>
        <file name="stubs/solr/SolrClient.php"/>
        <file name="stubs/solr/Utils/SolrObject.php"/>
        <file name="stubs/solr/Utils/SolrUtils.php"/>
        <file name="stubs/solr/Exceptions/SolrException.php"/>
        <file name="stubs/solr/Exceptions/SolrIllegalArgumentException.php"/>
        <file name="stubs/solr/Exceptions/SolrServerException.php"/>
        <file name="stubs/solr/Exceptions/SolrClientException.php"/>
        <file name="stubs/solr/Exceptions/SolrMissingMandatoryParameterException.php"/>
        <file name="stubs/solr/Exceptions/SolrIllegalOperationException.php"/>
        <file name="stubs/solr/constants.php"/>
        <file name="stubs/solr/Documents/SolrDocument.php"/>
        <file name="stubs/solr/Documents/SolrDocumentField.php"/>
        <file name="stubs/solr/Documents/SolrInputDocument.php"/>
        <file name="stubs/standard/_standard_manual.php"/>
        <file name="stubs/standard/_types.php"/>
        <file name="stubs/standard/standard_1.php"/>
        <file name="stubs/standard/standard_0.php"/>
        <file name="stubs/standard/standard_defines.php"/>
        <file name="stubs/standard/standard_2.php"/>
        <file name="stubs/standard/standard_3.php"/>
        <file name="stubs/standard/standard_7.php"/>
        <file name="stubs/standard/standard_6.php"/>
        <file name="stubs/standard/standard_4.php"/>
        <file name="stubs/standard/standard_5.php"/>
        <file name="stubs/standard/standard_8.php"/>
        <file name="stubs/standard/standard_9.php"/>
        <file name="stubs/standard/basic.php"/>
        <file name="stubs/pdo_mysql/pdo_mysql.php"/>
        <file name="stubs/rdkafka/functions.php"/>
        <file name="stubs/rdkafka/RdKafka.php"/>
        <file name="stubs/rdkafka/RdKafka/KafkaConsumerTopic.php"/>
        <file name="stubs/rdkafka/RdKafka/TopicConf.php"/>
        <file name="stubs/rdkafka/RdKafka/KafkaConsumer.php"/>
        <file name="stubs/rdkafka/RdKafka/Consumer.php"/>
        <file name="stubs/rdkafka/RdKafka/Conf.php"/>
        <file name="stubs/rdkafka/RdKafka/Producer.php"/>
        <file name="stubs/rdkafka/RdKafka/Metadata.php"/>
        <file name="stubs/rdkafka/RdKafka/Queue.php"/>
        <file name="stubs/rdkafka/RdKafka/Topic.php"/>
        <file name="stubs/rdkafka/RdKafka/Exception.php"/>
        <file name="stubs/rdkafka/RdKafka/Metadata/Partition.php"/>
        <file name="stubs/rdkafka/RdKafka/Metadata/Collection.php"/>
        <file name="stubs/rdkafka/RdKafka/Metadata/Topic.php"/>
        <file name="stubs/rdkafka/RdKafka/Message.php"/>
        <file name="stubs/rdkafka/RdKafka/ProducerTopic.php"/>
        <file name="stubs/rdkafka/RdKafka/TopicPartition.php"/>
        <file name="stubs/rdkafka/RdKafka/ConsumerTopic.php"/>
        <file name="stubs/rdkafka/constants.php"/>
        <file name="stubs/memcached/memcached.php"/>
        <file name="stubs/suhosin/suhosin.php"/>
        <file name="stubs/memcache/memcache.php"/>
        <file name="stubs/zip/zip.php"/>
        <file name="stubs/curl/curl.php"/>
        <file name="stubs/curl/curl_d.php"/>
        <file name="stubs/enchant/enchant.php"/>
        <file name="stubs/json/json.php"/>
        <file name="stubs/tidy/tidy.php"/>
        <file name="stubs/fileinfo/fileinfo.php"/>
        <file name="stubs/imagick/imagick.php"/>
        <file name="stubs/oci8/oci8.php"/>
        <file name="stubs/pdo_pgsql/pdo_pgsql.php"/>
        <file name="stubs/http/http.php"/>
        <file name="stubs/http/http3.php"/>
        <file name="stubs/odbc/odbc.php"/>
        <file name="stubs/gettext/gettext.php"/>
        <file name="stubs/sqlite3/sqlite3.php"/>
        <file name="stubs/SplType/SplType.php"/>
        <file name="stubs/mysql/mysql.php"/>
        <file name="stubs/mcrypt/mcrypt.php"/>
        <file name="stubs/libsodium/libsodium.php"/>
        <file name="stubs/pthreads/pthreads.php"/>
        <file name="stubs/yaf/yaf_namespace.php"/>
        <file name="stubs/yaf/yaf.php"/>
        <file name="stubs/mysqli/mysqli.php"/>
        <file name="stubs/pdflib/PDFlib.php"/>
        <file name="stubs/ZendCache/ZendCache.php"/>
        <file name="stubs/yar/yar.php"/>
        <file name="stubs/exif/exif.php"/>
        <file name="stubs/pgsql/pgsql.php"/>
        <file name="stubs/wincache/wincache.php"/>
        <file name="stubs/yaml/yaml.php"/>
        <file name="stubs/dom/dom_c.php"/>
        <file name="stubs/dom/dom.php"/>
        <file name="stubs/gd/gd.php"/>
        <file name="stubs/mongo/mongo.php"/>
        <file name="stubs/libevent/libevent.php"/>
        <file name="stubs/newrelic/newrelic.php"/>
        <file name="stubs/pcre/pcre.php"/>
        <file name="stubs/sodium/sodium.php"/>
        <file name="stubs/fann/fann.php"/>
        <file name="stubs/xcache/xcache.php"/>
        <file name="stubs/SimpleXML/SimpleXML.php"/>
        <file name="stubs/filter/filter.php"/>
        <file name="stubs/xmlreader/xmlreader.php"/>
        <file name="stubs/sync/sync.php"/>
        <file name="stubs/pcntl/pcntl.php"/>
        <file name="stubs/com_dotnet/com_dotnet.php"/>
        <file name="stubs/xmlrpc/xmlrpc.php"/>
        <file name="stubs/shmop/shmop.php"/>
        <file name="stubs/interbase/interbase.php"/>
        <file name="stubs/openssl/openssl.php"/>
        <file name="stubs/mapscript/mapscript.php"/>
        <file name="stubs/xsl/xsl.php"/>
        <file name="stubs/bcmath/bcmath.php"/>
        <file name="stubs/event/event.php"/>
        <file name="stubs/ZendDebugger/ZendDebugger.php"/>
        <file name="stubs/gnupg/gnupg.php"/>
        <file name="stubs/zmq/zmq.php"/>
        <file name="stubs/mssql/mssql.php"/>
        <file name="stubs/apache/apache.php"/>
        <file name="stubs/csprng/CSPRNG.php"/>
        <file name="stubs/ZendUtils/ZendUtils.php"/>
        <file name="stubs/igbinary/igbinary.php"/>
        <file name="stubs/mqseries/mqseries.php"/>
        <file name="stubs/mbstring/mbstring.php"/>
        <file name="stubs/Reflection/Reflection.php"/>
        <file name="stubs/couchbase/toplevel.php"/>
        <file name="stubs/couchbase/couchbase.php"/>
        <file name="stubs/session/session.php"/>
        <file name="stubs/session/SessionHandler.php"/>
    </stubs>
</psalm>

Also I installed my composer with docker, can it be the reason?

tvdijen commented 5 years ago

I'm facing the same issue: https://travis-ci.org/simplesamlphp/simplesamlphp/jobs/509120456#L733

We create an extended class here: https://github.com/simplesamlphp/simplesamlphp/blob/14e7466f9561a804101881dc5a4fb09d965f3165/lib/SimpleSAML/XHTML/Template.php#L289

It is extended from the original Twig-class here: https://github.com/jaimeperez/twig-configurable-i18n/blob/master/src/Twig/Environment.php#L12

The Twig-class is defined here: https://github.com/twigphp/Twig/blob/1ea78e2893e96fad0884ba1a6ad5ca6320f6a66c/src/Environment.php#L39

tvdijen commented 5 years ago

In my case, I was able to fix it by upgrading to a recent version of Psalm. I was still on the 0.x branch. Could this be your case as well @narekmarkosyan ?

narekmarkosyan commented 5 years ago

@tvdijen i'm using dev-master, updated it to be sure, but problem still there.

muglug commented 5 years ago

@narekmarkosyan are you able to reproduce the issue in a standalone repo?

narekmarkosyan commented 5 years ago

Created repo https://gitlab.com/narekmarkosyan/psalm_test. Same problem.

Just notice that without <UndefinedClass errorLevel="suppress"/> in issueHandlers i'm getting Class or interface PhpOffice\PhpWord\PhpWord does not exist And without <MissingDependency errorLevel="suppress"/> i'm getting App\Office\MyWord depends on class or interface phpoffice\phpword\phpword that does not exist

Only if that 2 options added in psalm.xml i see UndefinedMethod Error

muglug commented 5 years ago

Psalm doesn't see any errors in that directory with the Psalm config

<?xml version="1.0"?>
<psalm
    totallyTyped="false"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
>
    <projectFiles>
        <file name="test.php" />
        <ignoreFiles>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>
</psalm>

and Composer config

{
  "name": "Test",
  "require": {
    "phpoffice/phpword": "v0.13.*",
    "mpdf/mpdf": "v7.0.3",
    "vimeo/psalm": "^3.2"
  },
  "autoload": {
    "psr-4": {
      "App\\": "App/"
    }
  }
}
narekmarkosyan commented 5 years ago

It works when psalm installed in my repository, but doesn't work if my psalm installed in other repository and called like

<?xml version="1.0"?>
<psalm
    totallyTyped="false"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
>
    <projectFiles>
        <file name="../my_project/test.php" />
        <ignoreFiles>
            <directory name="../my_project/vendor" />
        </ignoreFiles>
    </projectFiles>
</psalm>

or with full path to files.