-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrutinizer fixes #76
Changes from 7 commits
8de7f8c
294ea1e
7dbdc50
6d26c55
37c2244
ef64e04
266f378
295b2da
98cfabb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,14 @@ class ReflectionFileNamespace | |
*/ | ||
public function __construct($fileName, $namespaceName, Namespace_ $namespaceNode = null) | ||
{ | ||
if (!is_string($fileName)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems, that you've started to change more code. I'd recommend doing this in another PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a change from my original commit from July 3rd before I ever issued this PR. I'm slightly confused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. I've reviewed only changes that Scrutinizer CI reported as fixes to existing issues. Probably this change fixed nothing of Scrutinizer CI reported bugs. In either case I think it's too much to check filename to be a string. Likely nobody would be crazy enough to pass non-string in there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason I made this addition was that it was flagged by Scrutinizer:
(Same comment as above) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then better to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While there are 3 places in the code where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the 3rd place, can you post a link to that code line? If total call count in that 3rd place is much smaller than sum of other 2 places, then from performance point it would be better to type cast before calling this method instead of checking in constructor. Same is valid for other similar place. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok... I'm happy to show you the three places that call this constructor, but the fact that you're asking indicates a failure to communicate on my part. I apologize for being unclear. Here are the 3 places that call this constructor: .../parser-reflection/src/ReflectionFile.php: 153 $namespaceName = $topLevelNode->name ? $topLevelNode->name->toString() : '';
154
155: $namespaces[$namespaceName] = new ReflectionFileNamespace(
156 $this->fileName,
157 $namespaceName, .../parser-reflection/src/ValueResolver/NodeExpressionResolver.php: 231 $fileName = $this->context->getFileName();
232 $namespaceName = $this->resolveScalarMagicConstNamespace();
233: $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName);
234 if ($fileNamespace->hasConstant($constantName)) {
235 $constantValue = $fileNamespace->getConstant($constantName); 500 $namespaceName = $this->resolveScalarMagicConstNamespace();
501
502: $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName);
503 return $fileNamespace->getClass($className);
504 } That said, I think this largely misses the point. Let me see if I can clear this up a little bit:
So, your choices are:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1 - keep. If we try to imagine real life examples, then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your quick response. I hope to have the final commit pushed this afternoon. |
||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'$fileName must be a string, but a %s was passed', | ||
gettype($fileName) | ||
) | ||
); | ||
} | ||
$fileName = PathResolver::realpath($fileName); | ||
if (!$namespaceNode) { | ||
$namespaceNode = ReflectionEngine::parseFileNamespace($fileName, $namespaceName); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,8 @@ public function ___debugInfo() | |
*/ | ||
public function __toString() | ||
{ | ||
$hasReturnType = $this->hasReturnType(); | ||
$returnType = $this->getReturnType(); | ||
$hasReturnType = ($returnType !== null); // Internally same as: $this->hasReturnType(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure, that comment is needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It came up in our discussion, and it wasn't obvious to me, so I added the comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that you will change $hasReturnType = ($returnType !== null); // Internally same as: $this->hasReturnType(); into $hasReturnType = $returnType !== null; but you haven't. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the parentheses was inadvertent and I'll remove them, but I do think the comment is helpful. It's an explanation why we aren't calling if you disagree, I'll remove it; or if you prefer, I can put the comment on it's own line. Update: To expedite things, I'll give you some unambiguous options ordered by my personal preference:
// Internally $this->getReturnType() !== null same as $this->hasReturnType()
$returnType = $this->getReturnType();
$hasReturnType = $returnType !== null;
$returnType = $this->getReturnType();
$hasReturnType = $returnType !== null; // Internally same as: $this->hasReturnType();
$returnType = $this->getReturnType();
$hasReturnType = $returnType !== null; |
||
$paramsNeeded = $hasReturnType || $this->getNumberOfParameters() > 0; | ||
$paramFormat = $paramsNeeded ? "\n\n - Parameters [%d] {%s\n }" : ''; | ||
$returnFormat = $hasReturnType ? "\n - Return [ %s ]" : ''; | ||
|
@@ -107,14 +108,22 @@ public function __toString() | |
$this->isFinal() ? ' final' : '', | ||
$this->isStatic() ? ' static' : '', | ||
$this->isAbstract() ? ' abstract' : '', | ||
join(' ', \Reflection::getModifierNames($this->getModifiers() & 1792)), | ||
join( | ||
' ', | ||
\Reflection::getModifierNames( | ||
$this->getModifiers() & | ||
(self::IS_PUBLIC | self::IS_PROTECTED | self::IS_PRIVATE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multi-line function call not indented correctly; expected 20 spaces but found 24 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this more expressive form of same thing? I wonder why you've added this in this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeh... probably less relevant to this PR, but I generally hate non-expressive "magic numbers", and I can across this one while working on this PR. It probably doesn't belong, but I felt like it made the code clearer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, let's keep it then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multi-line function call not indented correctly; expected 20 spaces but found 24 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any way so solve this CS issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I read the issue correctly, @Nitpick-CI wants As above, unambiguous options in my personal order of preference:
join(
' ',
\Reflection::getModifierNames(
$this->getModifiers() & (self::IS_PUBLIC | self::IS_PROTECTED | self::IS_PRIVATE)
)
),
join(
' ',
\Reflection::getModifierNames(
$this->getModifiers() &
(self::IS_PUBLIC | self::IS_PROTECTED | self::IS_PRIVATE)
)
),
join(
' ',
\Reflection::getModifierNames(
$this->getModifiers() &
(self::IS_PUBLIC | self::IS_PROTECTED | self::IS_PRIVATE)
)
), |
||
) | ||
), | ||
$this->getName(), | ||
$this->getFileName(), | ||
$this->getStartLine(), | ||
$this->getEndLine(), | ||
count($methodParameters), | ||
$paramString, | ||
$hasReturnType ? ReflectionType::convertToDisplayType($this->getReturnType()) : '' | ||
( $returnType ? | ||
ReflectionType::convertToDisplayType($returnType) : | ||
'UNUSED: Prevents convertToDisplayType() being called.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 , what is that? Are you sure code is never executed under normal conditions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I guess my "not quite a comment" explanatory string was unclear. When There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If If it's displayed, but same text isn't displayed in built-in reflection api, then this won't be compatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is indeed not displayed. I can easily change it back to the empty string. I'm trying to decide if I need a comment there to replace it. I admit that from a clarity standpoint, I don't like the way this function reads, but I think anything but an empty string probably just muddies the water. @aik099, what do you think? |
||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ public static function convertToDisplayType(\ReflectionType $type) | |
'int' => 'integer', | ||
'bool' => 'boolean' | ||
]; | ||
$displayType = $type->type; | ||
$displayType = (string) $type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure, that according to coding standard there should be space between type name and variable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like the way it looks either... it's what Scrutinizer was suggesting. I'm happy to loose the ugly space. It's your call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please locate other type cast operators in the code (not added by you) and see which style is used most. Then use most used style. |
||
if (isset($typeMap[$displayType])) { | ||
$displayType = $typeMap[$displayType]; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,8 +112,7 @@ protected function resolve(Node $node) | |
try { | ||
++$this->nodeLevel; | ||
|
||
$nodeType = $node->getType(); | ||
$methodName = 'resolve' . str_replace('_', '', $nodeType); | ||
$methodName = $this->getDispatchMethodFor($node); | ||
if (method_exists($this, $methodName)) { | ||
$value = $this->$methodName($node); | ||
} | ||
|
@@ -142,7 +141,7 @@ protected function resolveScalarString(Scalar\String_ $node) | |
protected function resolveScalarMagicConstMethod() | ||
{ | ||
if ($this->context instanceof \ReflectionMethod) { | ||
$fullName = $this->context->getDeclaringClass()->getName() . '::' . $this->context->getShortName(); | ||
$fullName = $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName(); | ||
|
||
return $fullName; | ||
} | ||
|
@@ -175,12 +174,12 @@ protected function resolveScalarMagicConstNamespace() | |
protected function resolveScalarMagicConstClass() | ||
{ | ||
if ($this->context instanceof \ReflectionClass) { | ||
return $this->context->getName(); | ||
return $this->context->name; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good. |
||
} | ||
if (method_exists($this->context, 'getDeclaringClass')) { | ||
$declaringClass = $this->context->getDeclaringClass(); | ||
if ($declaringClass instanceof \ReflectionClass) { | ||
return $declaringClass->getName(); | ||
return $declaringClass->name; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good. |
||
} | ||
} | ||
|
||
|
@@ -213,7 +212,7 @@ protected function resolveScalarMagicConstLine(MagicConst\Line $node) | |
protected function resolveScalarMagicConstTrait() | ||
{ | ||
if ($this->context instanceof \ReflectionClass && $this->context->isTrait()) { | ||
return $this->context->getName(); | ||
return $this->context->name; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good. |
||
} | ||
|
||
return ''; | ||
|
@@ -224,8 +223,6 @@ protected function resolveExprConstFetch(Expr\ConstFetch $node) | |
$constantValue = null; | ||
$isResolved = false; | ||
|
||
/** @var ReflectionFileNamespace|null $fileNamespace */ | ||
$fileNamespace = null; | ||
$isFQNConstant = $node->name instanceof Node\Name\FullyQualified; | ||
$constantName = $node->name->toString(); | ||
|
||
|
@@ -256,7 +253,22 @@ protected function resolveExprConstFetch(Expr\ConstFetch $node) | |
|
||
protected function resolveExprClassConstFetch(Expr\ClassConstFetch $node) | ||
{ | ||
$refClass = $this->fetchReflectionClass($node->class); | ||
$classToReflect = $node->class; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't seem to be related to Scrutinizer CI reported problems. Maybe belongs to separate PR with a description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why this issue isn't showing up for you, nor why I can't find links to individual Scrutinizer issues, but this is to address the Scrutinizer issue reported for this line that reads:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. So class constant can be an expression. Seem to addition in PHP syntax, that PHP-Parser now supports. In either cases a test for that is needed too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know you can do a constant fetch from a class name stored in a variable. I'm unsure what other As far as adding corresponding test cases, I agree, but I was lumping my test changes into a separate PR. (I'm shooting for 100% code coverage, but I've always been a cockeyed optimist.) I can add these tests to this PR after I've untangled my current repo branches. (I don't really want to do a stash right now.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I've meant const ONE = 1;
class foo {
// As of PHP 5.6.0
const TWO = ONE * 2;
const THREE = ONE + self::TWO;
const SENTENCE = 'The value of THREE is '.self::THREE;
} This way you can create test for that kind of syntax.
The tests for changed code needs to come as part of PR, where that code is changed. Later you can send another PR for improving code coverage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree we need to test for this case, but it isn't demonstrated in the example above. It would be something like this, which I'm doubting is valid PHP: const LEFT = 'Foo';
const RIGHT = 'Bar';
class FooBar {
const FILENAME = 'baz.php';
}
require((LEFT . RIGHT)::FILENAME); Like I said... I'm unsure if this is valid PHP, but I think, given that PhpParser accepts an expression, and we need something that can evaluate at compile time, something like this would be a valid test, even if not legal PHP currently. Opinions? Thumbing up to remind myself to add test cases. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything that would force PHP-Parser to create There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for reference: Variation of above sample code on 3v4l.org |
||
if (!($classToReflect instanceof Node\Name)) { | ||
$classToReflect = $this->resolve($classToReflect) ?: $classToReflect; | ||
if (!is_string($classToReflect)) { | ||
$reason = 'Unable'; | ||
if ($classToReflect instanceof Expr) { | ||
$methodName = $this->getDispatchMethodFor($classToReflect); | ||
$reason = "Method " . __CLASS__ . "::{$methodName}() not found trying"; | ||
} | ||
throw new ReflectionException("$reason to resolve class constant."); | ||
} | ||
// Strings evaluated as class names are always treated as fully | ||
// qualified. | ||
$classToReflect = new Node\Name\FullyQualified(ltrim($classToReflect, '\\')); | ||
} | ||
$refClass = $this->fetchReflectionClass($classToReflect); | ||
$constantName = $node->name; | ||
|
||
// special handling of ::class constants | ||
|
@@ -265,7 +277,7 @@ protected function resolveExprClassConstFetch(Expr\ClassConstFetch $node) | |
} | ||
|
||
$this->isConstant = true; | ||
$this->constantName = (string)$node->class . '::' . $constantName; | ||
$this->constantName = (string)$classToReflect . '::' . $constantName; | ||
|
||
return $refClass->getConstant($constantName); | ||
} | ||
|
@@ -430,6 +442,12 @@ protected function resolveExprBinaryOpLogicalXor(Expr\BinaryOp\LogicalXor $node) | |
return $this->resolve($node->left) xor $this->resolve($node->right); | ||
} | ||
|
||
private function getDispatchMethodFor(Node $node) | ||
{ | ||
$nodeType = $node->getType(); | ||
return 'resolve' . str_replace('_', '', $nodeType); | ||
} | ||
|
||
/** | ||
* Utility method to fetch reflection class instance by name | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,9 @@ | |
use Go\ParserReflection\ReflectionEngine; | ||
|
||
/** | ||
* This file is used for automatic configuration of Go\ParserReflection\ReflectionEngine class | ||
* This file is used for automatic configuration of | ||
* Go\ParserReflection\ReflectionEngine class | ||
*/ | ||
ReflectionEngine::init(new ComposerLocator()); | ||
// Polifyll for PHP<7.0 | ||
if (!class_exists(ReflectionType::class, false)) { | ||
class ReflectionType {} | ||
} | ||
|
||
require(__DIR__ . '/polyfill.php'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a fix for https://scrutinizer-ci.com/g/goaop/parser-reflection/inspections/eaf283f6-f982-44a4-bb28-51489bcba537/issues/files/src/bootstrap.php?status=fixed&orderField=path&order=asc&honorSelectedPaths=0 , but I'm not sure it's worth it. Better to reduce file operation count (the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... I think this is a case of minor improvement in PSR-1 compliance for 1 extra small file load once, during execution. I think it's a worthwhile cost... and I think having Polyfills in a file called polyfill.php helps people know where to find them. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Parser Reflection API | ||
* | ||
* @copyright Copyright 2015, Lisachenko Alexander <[email protected]> | ||
* | ||
* This source file is subject to the license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
/** | ||
* This file is for ployfilling classes not defined in all supported | ||
* versions of PHP, (i.e. PHP < 7). | ||
*/ | ||
if (!class_exists(ReflectionType::class, false)) { | ||
/* Dummy polyfill class */ | ||
class ReflectionType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is obviously a non-issue for a polyfill class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each class must be in a namespace of at least one level (a top-level vendor name) |
||
{ | ||
public function allowsNull() | ||
{ | ||
return true; | ||
} | ||
|
||
public function isBuiltin() | ||
{ | ||
return false; | ||
} | ||
|
||
public function __toString() | ||
{ | ||
return ''; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems, that you've started to change more code. I'd recommend doing this in another PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a change from my original commit from July 3rd before I ever issued this PR. I'm slightly confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I've reviewed only changes that Scrutinizer CI reported as fixes to existing issues. Probably this change fixed nothing of Scrutinizer CI reported bugs.
In either case I think it's too much to check filename to be a string. Likely nobody would be crazy enough to pass non-string in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason I made this addition was that it was flagged by Scrutinizer:
I think this based on type variations in the calling functions, despite this function only ever being called with string. I expect the other change that might fix this is isolating the parameter into a distinct, string-only variable that is used when calling this method. I think this type check is the easier solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then better to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this PR was to address the Scrutinizer issues. This does that and it was in the PR from the beginning.
I'm confused why this is suddenly an issue?
Let me investigate the calling code to see if that is more easily addressed than this. I'll get back to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Scrutinizer CI told that multiple types could come in and you've restricted to type check instead of actually investigating places from where multiple types could come in and deciding on fixing these places instead. This could be a lots of changes and that's why I've suggested another PR.
P.S.
You don't need to put ALL fixing in single PR. Better to send smaller manageable PRs. Right now this PR has large discussion that already is hard to track what's going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok... I searched the code, and (outside of
tests/
) nothing within ParserReflection instantiatesGo\ParserReflection\ReflectionFile
, and ever use of it is annotated asstring
: The constructor is annotated@param string
, the class property is annotated@var string
, and the accessor is annotated@return string
. I can only assume that this a plea for enforcing type safety rather than warning that badly typed data is being redirected here. I happen to be a fan of enforcing types where appropriate, so I see no harm in leaving this change, and the matching one forReflectionFileNamespace
intact.👎 Keeping change in PR pending @lisachenko's approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enforcing something, that will never happen would only slow down whole code checking process. For that reason I'd rather not check unless somebody stumbles upon this and reports it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it then. I hope this won't be a performance issue.