Comments (20)
<?php
namespace Drupal\Component\Utility;
/**
* Provides helper methods for reflection.
*/
final class Reflection {
/**
* Gets the parameter's class name.
*
* @param \ReflectionParameter $parameter
* The parameter.
*
* @return string|null
* The parameter's class name or NULL if the parameter is not a class.
*/
public static function getParameterClassName(\ReflectionParameter $parameter) : ?string {
$name = NULL;
if ($parameter->hasType() && !$parameter->getType()->isBuiltin()) {
$name = $parameter->getType()->getName();
$lc_name = strtolower($name);
switch ($lc_name) {
case 'self':
return $parameter->getDeclaringClass()->getName();
case 'parent':
return ($parent = $parameter->getDeclaringClass()->getParentClass()) ? $parent->name : NULL;
}
}
return $name;
}
}
from -.
from -.
from -.
from -.
from -.
from -.
from -.
Let us know more about type resource in php
from -.
from -.
@andypost Please provide a comment for this commit:
from -.
@andypost Please provide a comment for this commit:
<?php
/**
* {@inheritdoc}
*/
public function rollBack($savepoint_name = 'drupal_transaction') {
// MySQL will automatically commit transactions when tables are altered or
// created (DDL transactions are not supported). Prevent triggering an
// exception to ensure that the error that has caused the rollback is
// properly reported.
if (!$this->connection->inTransaction()) {
// On PHP 7 $this->connection->inTransaction() will return TRUE and
// $this->connection->rollback() does not throw an exception; the
// following code is unreachable.
// If \Drupal\Core\Database\Connection::rollBack() would throw an
// exception then continue to throw an exception.
if (!$this->inTransaction()) {
throw new TransactionNoActiveException();
}
// A previous rollback to an earlier savepoint may mean that the savepoint
// in question has already been accidentally committed.
if (!isset($this->transactionLayers[$savepoint_name])) {
throw new TransactionNoActiveException();
}
trigger_error('Rollback attempted when there is no active transaction. This can cause data integrity issues.', E_USER_WARNING);
return;
}
return parent::rollBack($savepoint_name);
}
/**
* {@inheritdoc}
*/
protected function doCommit() {
// MySQL will automatically commit transactions when tables are altered or
// created (DDL transactions are not supported). Prevent triggering an
// exception in this case as all statements have been committed.
if ($this->connection->inTransaction()) {
// On PHP 7 $this->connection->inTransaction() will return TRUE and
// $this->connection->commit() does not throw an exception.
$success = parent::doCommit();
}
else {
// Process the post-root (non-nested) transaction commit callbacks. The
// following code is copied from
// \Drupal\Core\Database\Connection::doCommit()
$success = TRUE;
if (!empty($this->rootTransactionEndCallbacks)) {
$callbacks = $this->rootTransactionEndCallbacks;
$this->rootTransactionEndCallbacks = [];
foreach ($callbacks as $callback) {
call_user_func($callback, $success);
}
}
}
return $success;
}
@andypost, Thank you for such clear comments in commit.
Чи могли б ви прокоментувати цю контрибуцію на живо, тому що доить складно усвідомити цей кусок тесту:
from -.
Unescaped "@" in ContextProviderInterface doc comment
Issue #3014969 by TR, longwave, Abhijith S, joachim, shimpy
from -.
from -.
from -.
from -.
:"typo3/phar-stream-wrapper": "v3.1.6"
from -.
from -.
Sort direction is not hidden when no sort field is selected
from -.
from -.
Refactor WHY??? Issue #2987980 by alexpott, longwave, Lendude, jibran: Refactor UncaughtExceptionTest to not use cUrl
from -.
Related Issues (10)
- How to set numerical id of config_page entity in views header based on config page machine name HOT 1
- #08-2020/11 Issues Notes HOT 15
- Custom notes in md -> pdf file
- Ion4Ї Notes HOT 2
- #09-2020/11 drupal core review HOT 12
- #10-2020/12 Drupal Core overview HOT 14
- #11-2020/12 Drupal Core overview HOT 16
- Screens with interesting code from internet HOT 2
- Git 2.32.0 issues to report [bash: : unrecognized history modifier]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from -.