1
0
mirror of synced 2025-02-10 17:29:27 +03:00

Minor coding style fixes and more docblock removal

This commit is contained in:
Thomas Ploch 2017-08-15 10:17:20 +02:00
parent b7ae5b4afb
commit ec3eed68ca
3 changed files with 12 additions and 27 deletions

View File

@ -46,7 +46,7 @@ class AnnotationExporter extends AbstractExporter
*/ */
public function exportClassMetadata(ClassMetadataInfo $metadata): string public function exportClassMetadata(ClassMetadataInfo $metadata): string
{ {
if ( ! $this->_entityGenerator) { if (!$this->_entityGenerator) {
throw new \RuntimeException('For the AnnotationExporter you must set an EntityGenerator instance with the setEntityGenerator() method.'); throw new \RuntimeException('For the AnnotationExporter you must set an EntityGenerator instance with the setEntityGenerator() method.');
} }
@ -58,21 +58,11 @@ class AnnotationExporter extends AbstractExporter
return $this->_entityGenerator->generateEntityClass($metadata); return $this->_entityGenerator->generateEntityClass($metadata);
} }
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*
* @return string
*/
protected function _generateOutputPath(ClassMetadataInfo $metadata): string protected function _generateOutputPath(ClassMetadataInfo $metadata): string
{ {
return $this->_outputDir . '/' . str_replace('\\', '/', $metadata->name) . $this->_extension; return $this->_outputDir . '/' . str_replace('\\', '/', $metadata->name) . $this->_extension;
} }
/**
* @param \Doctrine\ORM\Tools\EntityGenerator $entityGenerator
*
* @return void
*/
public function setEntityGenerator(EntityGenerator $entityGenerator): void public function setEntityGenerator(EntityGenerator $entityGenerator): void
{ {
$this->_entityGenerator = $entityGenerator; $this->_entityGenerator = $entityGenerator;

View File

@ -161,11 +161,6 @@ class PhpExporter extends AbstractExporter
return implode("\n", $lines); return implode("\n", $lines);
} }
/**
* @param mixed $var
*
* @return string
*/
protected function _varExport($var): string protected function _varExport($var): string
{ {
$export = var_export($var, true); $export = var_export($var, true);
@ -190,11 +185,11 @@ class PhpExporter extends AbstractExporter
foreach ($metadata->entityListeners as $event => $entityListenerConfig) { foreach ($metadata->entityListeners as $event => $entityListenerConfig) {
foreach ($entityListenerConfig as $entityListener) { foreach ($entityListenerConfig as $entityListener) {
$lines[] = sprintf( $lines[] = \sprintf(
'$metadata->addEntityListener(%s, %s, %s);', '$metadata->addEntityListener(%s, %s, %s);',
var_export($event, true), \var_export($event, true),
var_export($entityListener['class'], true), \var_export($entityListener['class'], true),
var_export($entityListener['method'], true) \var_export($entityListener['method'], true)
); );
} }
} }

View File

@ -41,10 +41,10 @@ class XmlExporter extends AbstractExporter
*/ */
public function exportClassMetadata(ClassMetadataInfo $metadata): string public function exportClassMetadata(ClassMetadataInfo $metadata): string
{ {
$xml = new SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><doctrine-mapping ". $xml = new SimpleXmlElement('<?xml version="1.0" encoding="utf-8"?><doctrine-mapping ' .
"xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" " . 'xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" ' .
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ". 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' .
"xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\" />"); 'xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" />');
if ($metadata->isMappedSuperclass) { if ($metadata->isMappedSuperclass) {
$root = $xml->addChild('mapped-superclass'); $root = $xml->addChild('mapped-superclass');
@ -98,7 +98,7 @@ class XmlExporter extends AbstractExporter
$trackingPolicy = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy); $trackingPolicy = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy);
if ( $trackingPolicy != 'DEFERRED_IMPLICIT') { if ($trackingPolicy != 'DEFERRED_IMPLICIT') {
$root->addChild('change-tracking-policy', $trackingPolicy); $root->addChild('change-tracking-policy', $trackingPolicy);
} }
@ -144,7 +144,7 @@ class XmlExporter extends AbstractExporter
} }
} }
if ( ! $metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { if (!$metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
$id[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType; $id[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType;
} }
@ -430,7 +430,7 @@ class XmlExporter extends AbstractExporter
{ {
$sequenceDefinition = $metadata->sequenceGeneratorDefinition; $sequenceDefinition = $metadata->sequenceGeneratorDefinition;
if (! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { if (!($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) {
return; return;
} }