opt
/
cpanel
/
ea-wappspector
/
vendor
/
rector
/
rector
/
rules
/
CodingStyle
/
Reflection
➕ New
📤 Upload
✎ Editing:
VendorLocationDetector.php
← Back
<?php declare (strict_types=1); namespace Rector\CodingStyle\Reflection; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\MethodReflection; use Rector\FileSystem\FilePathHelper; final class VendorLocationDetector { /** * @readonly * @var \Rector\FileSystem\FilePathHelper */ private $filePathHelper; public function __construct(FilePathHelper $filePathHelper) { $this->filePathHelper = $filePathHelper; } public function detectMethodReflection(MethodReflection $methodReflection) : bool { $declaringClassReflection = $methodReflection->getDeclaringClass(); $fileName = $declaringClassReflection->getFileName(); return $this->detect($fileName); } public function detectFunctionReflection(FunctionReflection $functionReflection) : bool { $fileName = $functionReflection->getFileName(); return $this->detect($fileName); } private function detect(?string $fileName = null) : bool { // probably internal if ($fileName === null) { return \false; } $normalizedFileName = $this->filePathHelper->normalizePathAndSchema($fileName); return \strpos($normalizedFileName, '/vendor/') !== \false; } }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel