Skip to content

Commit e72128f

Browse files
committed
CS: Use "self" keyword instead of class name if possible
1 parent feb48c2 commit e72128f

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function end()
224224
public static function buildExpressions(array $expressions)
225225
{
226226
foreach ($expressions as $k => $expr) {
227-
if ($expr instanceof ExprBuilder) {
227+
if ($expr instanceof self) {
228228
$if = $expr->ifPart;
229229
$then = $expr->thenPart;
230230
$expressions[$k] = function ($v) use ($if, $then) {

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
8282
try {
8383
$loader = $this->resolve($resource, $type);
8484

85-
if ($loader instanceof FileLoader && null !== $this->currentDir) {
85+
if ($loader instanceof self && null !== $this->currentDir) {
8686
// we fallback to the current locator to keep BC
8787
// as some some loaders do not call the parent __construct()
8888
// @deprecated should be removed in 3.0

src/Symfony/Component/HttpFoundation/File/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function getTargetFile($directory, $name = null)
139139

140140
$target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
141141

142-
return new File($target, false);
142+
return new self($target, false);
143143
}
144144

145145
/**

src/Symfony/Component/Intl/Intl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function getCurrencyBundle()
117117
{
118118
if (null === self::$currencyBundle) {
119119
self::$currencyBundle = new CurrencyBundle(
120-
self::getDataDirectory().'/'.Intl::CURRENCY_DIR,
120+
self::getDataDirectory().'/'.self::CURRENCY_DIR,
121121
self::getEntryReader(),
122122
self::getLocaleBundle()
123123
);
@@ -135,11 +135,11 @@ public static function getLanguageBundle()
135135
{
136136
if (null === self::$languageBundle) {
137137
self::$languageBundle = new LanguageBundle(
138-
self::getDataDirectory().'/'.Intl::LANGUAGE_DIR,
138+
self::getDataDirectory().'/'.self::LANGUAGE_DIR,
139139
self::getEntryReader(),
140140
self::getLocaleBundle(),
141141
new ScriptDataProvider(
142-
self::getDataDirectory().'/'.Intl::SCRIPT_DIR,
142+
self::getDataDirectory().'/'.self::SCRIPT_DIR,
143143
self::getEntryReader()
144144
)
145145
);
@@ -157,7 +157,7 @@ public static function getLocaleBundle()
157157
{
158158
if (null === self::$localeBundle) {
159159
self::$localeBundle = new LocaleBundle(
160-
self::getDataDirectory().'/'.Intl::LOCALE_DIR,
160+
self::getDataDirectory().'/'.self::LOCALE_DIR,
161161
self::getEntryReader()
162162
);
163163
}
@@ -174,7 +174,7 @@ public static function getRegionBundle()
174174
{
175175
if (null === self::$regionBundle) {
176176
self::$regionBundle = new RegionBundle(
177-
self::getDataDirectory().'/'.Intl::REGION_DIR,
177+
self::getDataDirectory().'/'.self::REGION_DIR,
178178
self::getEntryReader(),
179179
self::getLocaleBundle()
180180
);

src/Symfony/Component/PropertyAccess/PropertyPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
7676
public function __construct($propertyPath)
7777
{
7878
// Can be used as copy constructor
79-
if ($propertyPath instanceof PropertyPath) {
79+
if ($propertyPath instanceof self) {
8080
/* @var PropertyPath $propertyPath */
8181
$this->elements = $propertyPath->elements;
8282
$this->singulars = $propertyPath->singulars;

src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function all()
5050
*/
5151
public function add($child)
5252
{
53-
if ($child instanceof DumperCollection) {
53+
if ($child instanceof self) {
5454
$child->setParent($this);
5555
}
5656
$this->children[] = $child;
@@ -64,7 +64,7 @@ public function add($child)
6464
public function setAll(array $children)
6565
{
6666
foreach ($children as $child) {
67-
if ($child instanceof DumperCollection) {
67+
if ($child instanceof self) {
6868
$child->setParent($this);
6969
}
7070
}

src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function addPrefixRoute(DumperRoute $route)
6666

6767
// Prefix starts with route's prefix
6868
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
69-
$child = new DumperPrefixCollection();
69+
$child = new self();
7070
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix) + 1));
7171
$collection->add($child);
7272

src/Symfony/Component/Security/Acl/Domain/RoleSecurityIdentity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getRole()
5252
*/
5353
public function equals(SecurityIdentityInterface $sid)
5454
{
55-
if (!$sid instanceof RoleSecurityIdentity) {
55+
if (!$sid instanceof self) {
5656
return false;
5757
}
5858

src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getClass()
102102
*/
103103
public function equals(SecurityIdentityInterface $sid)
104104
{
105-
if (!$sid instanceof UserSecurityIdentity) {
105+
if (!$sid instanceof self) {
106106
return false;
107107
}
108108

src/Symfony/Component/Validator/Constraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function __set($option, $value)
154154
*/
155155
public function addImplicitGroupName($group)
156156
{
157-
if (in_array(Constraint::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) {
157+
if (in_array(self::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) {
158158
$this->groups[] = $group;
159159
}
160160
}

0 commit comments

Comments
 (0)