Repository: symfony/symfony
File: src/Symfony/Component/Config/Resource/ReflectionClassResource.php (PHP)

Code before:
            yield print_r($class->getConstants(), true);
        }

        if (!$class->isInterface()) {
            $defaults = $class->getDefaultProperties();

            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
                foreach ($p->getAttributes() as $a) {
                    $attributes[] = [$a->getName(), (string) $a];
                }
                yield print_r($attributes, true);
                $attributes = [];

                yield $p->getDocComment();
                yield $p->isDefault() ? '<default>' : '';
                yield $p->isPublic() ? 'public' : 'protected';
                yield $p->isStatic() ? 'static' : '';
                yield '$'.$p->name;
                yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
            }
        }

        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
            foreach ($this->excludedVendors as $vendor) {
                $file = $m->getFileName();
                if (str_starts_with($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
                    continue 2;
                }
            }

            foreach ($m->getAttributes() as $a) {
                $attributes[] = [$a->getName(), (string) $a];
            }
            yield print_r($attributes, true);
            $attributes = [];

            $defaults = [];
            foreach ($m->getParameters() as $p) {
                foreach ($p->getAttributes() as $a) {
                    $attributes[] = [$a->getName(), (string) $a];
                }
                yield print_r($attributes, true);
                $attributes = [];

                if (!$p->isDefaultValueAvailable()) {
                    $defaults[$p->name] = null;

                    continue;
                }

                $defaults[$p->name] = (string) $p;

Review comment (performance):
```suggestion
                if (str_starts_with($file, $vendor.'/') || str_starts_with($file, $vendor.\DIRECTORY_SEPARATOR)) {
```

Would that be significantly slower?

Code after:
            yield print_r($class->getConstants(), true);
        }

        if (!$class->isInterface()) {
            $defaults = $class->getDefaultProperties();

            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
                foreach ($p->getAttributes() as $a) {
                    $attributes[] = [$a->getName(), (string) $a];
                }
                yield print_r($attributes, true);
                $attributes = [];

                yield $p->getDocComment();
                yield $p->isDefault() ? '<default>' : '';
                yield $p->isPublic() ? 'public' : 'protected';
                yield $p->isStatic() ? 'static' : '';
                yield '$'.$p->name;
                yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
            }
        }

        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
            foreach ($this->excludedVendors as $vendor) {
                $file = $m->getFileName();
                if (\in_array($file[\strlen($vendor)] ?? '', ['/', \DIRECTORY_SEPARATOR], true) && str_starts_with($file, $vendor)) {
                    continue 2;
                }
            }

            foreach ($m->getAttributes() as $a) {
                $attributes[] = [$a->getName(), (string) $a];
            }
            yield print_r($attributes, true);
            $attributes = [];

            $defaults = [];
            foreach ($m->getParameters() as $p) {
                foreach ($p->getAttributes() as $a) {
                    $attributes[] = [$a->getName(), (string) $a];
                }
                yield print_r($attributes, true);
                $attributes = [];

                if (!$p->isDefaultValueAvailable()) {
                    $defaults[$p->name] = null;

                    continue;
                }

                $defaults[$p->name] = (string) $p;