@@ -36,6 +36,6 @@ |
||
| 36 | 36 | * @param string $key |
| 37 | 37 | * @return array |
| 38 | 38 | */ |
| 39 | - public function get( $key ); |
|
| 39 | + public function get($key); |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -34,66 +34,66 @@ discard block |
||
| 34 | 34 | class V4ModuleDefinition implements ModuleDefinition { |
| 35 | 35 | |
| 36 | 36 | private static $moduleDescriptions = [ |
| 37 | - 'functions' => [ 'styles' => [ 'functions' => [ 'position' => 'functions' ] ] ], |
|
| 38 | - 'variables' => [ 'styles' => |
|
| 39 | - [ 'variables' => [ 'position' => 'variables' ] ], 'dependencies' => 'functions' ], |
|
| 40 | - 'mixins' => [ 'styles' => 'mixins' ], |
|
| 41 | - 'root' => [ 'styles' => 'root' ], |
|
| 42 | - 'reboot' => [ 'styles' => 'reboot' ], |
|
| 43 | - 'type' => [ 'styles' => 'type' ], |
|
| 44 | - 'images' => [ 'styles' => 'images' ], |
|
| 45 | - 'code' => [ 'styles' => 'code' ], |
|
| 46 | - 'grid' => [ 'styles' => 'grid' ], |
|
| 47 | - 'tables' => [ 'styles' => 'tables' ], |
|
| 48 | - 'forms' => [ 'styles' => 'forms' ], |
|
| 49 | - 'buttons' => [ 'styles' => 'buttons' ], |
|
| 50 | - 'transitions' => [ 'styles' => 'transitions' ], |
|
| 51 | - 'dropdown' => [ 'styles' => |
|
| 52 | - 'dropdown', 'scripts' => 'dropdown.js', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 53 | - 'button-group' => [ 'styles' => 'button-group', 'dependencies' => [ 'buttons' ] ], |
|
| 54 | - 'input-group' => [ 'styles' => 'input-group', 'dependencies' => [ 'forms' ] ], |
|
| 55 | - 'custom-forms' => [ 'styles' => 'custom-forms' ], |
|
| 56 | - 'nav' => [ 'styles' => 'nav' ], |
|
| 57 | - 'navbar' => [ 'styles' => 'navbar' ], |
|
| 58 | - 'card' => [ 'styles' => 'card' ], |
|
| 59 | - 'breadcrumb' => [ 'styles' => 'breadcrumb' ], |
|
| 60 | - 'pagination' => [ 'styles' => 'pagination' ], |
|
| 61 | - 'badge' => [ 'styles' => 'badge' ], |
|
| 62 | - 'jumbotron' => [ 'styles' => 'jumbotron' ], |
|
| 63 | - 'alert' => [ 'styles' => 'alert' ], |
|
| 64 | - 'progress' => [ 'styles' => 'progress' ], |
|
| 65 | - 'media' => [ 'styles' => 'media' ], |
|
| 66 | - 'list-group' => [ 'styles' => 'list-group' ], |
|
| 67 | - 'close' => [ 'styles' => 'close' ], |
|
| 68 | - 'toasts' => [ 'styles' => |
|
| 69 | - 'toasts', 'scripts' => 'toast.js', 'dependencies' => 'js-util' ], |
|
| 70 | - 'modal' => [ 'styles' => 'modal', 'scripts' => 'modal.js' ], |
|
| 71 | - 'tooltip' => [ 'styles' => 'tooltip', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 72 | - 'popover' => [ 'styles' => |
|
| 73 | - 'popover', 'dependencies' => [ 'popper', 'tooltip', 'js-util' ] ], |
|
| 74 | - 'carousel' => [ 'styles' => |
|
| 75 | - 'carousel', 'scripts' => 'carousel.js', 'dependencies' => 'js-util' ], |
|
| 76 | - 'spinners' => [ 'styles' => 'spinners' ], |
|
| 77 | - 'utilities' => [ 'styles' => 'utilities' ], |
|
| 78 | - 'print' => [ 'styles' => 'print' ], |
|
| 79 | - 'active-buttons' => [ 'scripts' => 'button.js', 'dependencies' => [ 'buttons' ] ], |
|
| 80 | - 'dismissable-alert' => [ 'scripts' => 'alert.js', 'dependencies' => [ 'alert', 'js-util' ] ], |
|
| 81 | - 'collapse' => [ 'scripts' => 'collapse.js' ], |
|
| 82 | - 'scrollspy' => [ 'scripts' => 'scrollspy.js', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 83 | - 'tab' => [ 'scripts' => 'tab.js', 'dependencies' => [ 'list-group' ] ], |
|
| 84 | - 'js-util' => [ 'scripts' => 'util.js' ], |
|
| 85 | - 'popper' => [ 'scripts' => 'popper.js' ], |
|
| 37 | + 'functions' => ['styles' => ['functions' => ['position' => 'functions']]], |
|
| 38 | + 'variables' => ['styles' => |
|
| 39 | + ['variables' => ['position' => 'variables']], 'dependencies' => 'functions'], |
|
| 40 | + 'mixins' => ['styles' => 'mixins'], |
|
| 41 | + 'root' => ['styles' => 'root'], |
|
| 42 | + 'reboot' => ['styles' => 'reboot'], |
|
| 43 | + 'type' => ['styles' => 'type'], |
|
| 44 | + 'images' => ['styles' => 'images'], |
|
| 45 | + 'code' => ['styles' => 'code'], |
|
| 46 | + 'grid' => ['styles' => 'grid'], |
|
| 47 | + 'tables' => ['styles' => 'tables'], |
|
| 48 | + 'forms' => ['styles' => 'forms'], |
|
| 49 | + 'buttons' => ['styles' => 'buttons'], |
|
| 50 | + 'transitions' => ['styles' => 'transitions'], |
|
| 51 | + 'dropdown' => ['styles' => |
|
| 52 | + 'dropdown', 'scripts' => 'dropdown.js', 'dependencies' => ['popper', 'js-util']], |
|
| 53 | + 'button-group' => ['styles' => 'button-group', 'dependencies' => ['buttons']], |
|
| 54 | + 'input-group' => ['styles' => 'input-group', 'dependencies' => ['forms']], |
|
| 55 | + 'custom-forms' => ['styles' => 'custom-forms'], |
|
| 56 | + 'nav' => ['styles' => 'nav'], |
|
| 57 | + 'navbar' => ['styles' => 'navbar'], |
|
| 58 | + 'card' => ['styles' => 'card'], |
|
| 59 | + 'breadcrumb' => ['styles' => 'breadcrumb'], |
|
| 60 | + 'pagination' => ['styles' => 'pagination'], |
|
| 61 | + 'badge' => ['styles' => 'badge'], |
|
| 62 | + 'jumbotron' => ['styles' => 'jumbotron'], |
|
| 63 | + 'alert' => ['styles' => 'alert'], |
|
| 64 | + 'progress' => ['styles' => 'progress'], |
|
| 65 | + 'media' => ['styles' => 'media'], |
|
| 66 | + 'list-group' => ['styles' => 'list-group'], |
|
| 67 | + 'close' => ['styles' => 'close'], |
|
| 68 | + 'toasts' => ['styles' => |
|
| 69 | + 'toasts', 'scripts' => 'toast.js', 'dependencies' => 'js-util'], |
|
| 70 | + 'modal' => ['styles' => 'modal', 'scripts' => 'modal.js'], |
|
| 71 | + 'tooltip' => ['styles' => 'tooltip', 'dependencies' => ['popper', 'js-util']], |
|
| 72 | + 'popover' => ['styles' => |
|
| 73 | + 'popover', 'dependencies' => ['popper', 'tooltip', 'js-util']], |
|
| 74 | + 'carousel' => ['styles' => |
|
| 75 | + 'carousel', 'scripts' => 'carousel.js', 'dependencies' => 'js-util'], |
|
| 76 | + 'spinners' => ['styles' => 'spinners'], |
|
| 77 | + 'utilities' => ['styles' => 'utilities'], |
|
| 78 | + 'print' => ['styles' => 'print'], |
|
| 79 | + 'active-buttons' => ['scripts' => 'button.js', 'dependencies' => ['buttons']], |
|
| 80 | + 'dismissable-alert' => ['scripts' => 'alert.js', 'dependencies' => ['alert', 'js-util']], |
|
| 81 | + 'collapse' => ['scripts' => 'collapse.js'], |
|
| 82 | + 'scrollspy' => ['scripts' => 'scrollspy.js', 'dependencies' => ['popper', 'js-util']], |
|
| 83 | + 'tab' => ['scripts' => 'tab.js', 'dependencies' => ['list-group']], |
|
| 84 | + 'js-util' => ['scripts' => 'util.js'], |
|
| 85 | + 'popper' => ['scripts' => 'popper.js'], |
|
| 86 | 86 | |
| 87 | - 'bs-core' => [ 'dependencies' => [ 'variables', 'mixins' ] ], |
|
| 88 | - 'bs-reboot' => [ 'dependencies' => [ 'bs-core', 'reboot' ] ], |
|
| 89 | - 'bs-grid' => [ 'styles' => 'bootstrap-grid' ], |
|
| 87 | + 'bs-core' => ['dependencies' => ['variables', 'mixins']], |
|
| 88 | + 'bs-reboot' => ['dependencies' => ['bs-core', 'reboot']], |
|
| 89 | + 'bs-grid' => ['styles' => 'bootstrap-grid'], |
|
| 90 | 90 | |
| 91 | - 'bs-basic' => [ 'dependencies' => [ |
|
| 91 | + 'bs-basic' => ['dependencies' => [ |
|
| 92 | 92 | 'bs-core', 'root', 'reboot', 'type', 'images', 'code', 'grid', |
| 93 | 93 | 'tables', 'transitions', 'utilities', 'print' |
| 94 | - ] ], |
|
| 94 | + ]], |
|
| 95 | 95 | |
| 96 | - 'bs-all' => [ 'dependencies' => [ |
|
| 96 | + 'bs-all' => ['dependencies' => [ |
|
| 97 | 97 | 'bs-core', 'root', 'reboot', 'type', 'images', 'code', 'grid', |
| 98 | 98 | 'tables', 'forms', 'buttons', 'transitions', 'dropdown', |
| 99 | 99 | 'button-group', 'input-group', 'custom-forms', 'nav', 'navbar', |
@@ -101,15 +101,15 @@ discard block |
||
| 101 | 101 | 'progress', 'media', 'list-group', 'close', 'toasts', 'modal', 'tooltip', |
| 102 | 102 | 'popover', 'carousel', 'spinners', 'utilities', 'print', 'active-buttons', |
| 103 | 103 | 'dismissable-alert', 'collapse', 'scrollspy', 'tab', 'js-util', |
| 104 | - ] ], |
|
| 104 | + ]], |
|
| 105 | 105 | |
| 106 | 106 | // TODO: Add each SCSS util separately? |
| 107 | 107 | // TODO: Add each SCSS mixin module separately? |
| 108 | 108 | |
| 109 | 109 | ]; |
| 110 | 110 | |
| 111 | - private static $coreModules = [ 'bs-core' ]; |
|
| 112 | - private static $optionalModules = [ 'bs-all' ]; |
|
| 111 | + private static $coreModules = ['bs-core']; |
|
| 112 | + private static $optionalModules = ['bs-all']; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @see ModuleDefinition::get |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @return array |
| 122 | 122 | * @throws InvalidArgumentException |
| 123 | 123 | */ |
| 124 | - public function get( $key ) { |
|
| 125 | - switch ( $key ) { |
|
| 124 | + public function get($key) { |
|
| 125 | + switch ($key) { |
|
| 126 | 126 | case 'core': |
| 127 | 127 | return self::$coreModules; |
| 128 | 128 | case 'optional': |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | return self::$moduleDescriptions; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - throw new InvalidArgumentException( 'Expected a valid key' ); |
|
| 134 | + throw new InvalidArgumentException('Expected a valid key'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param mixed[] $configuration |
| 51 | 51 | */ |
| 52 | - public function __construct( array $configuration ) { |
|
| 52 | + public function __construct(array $configuration) { |
|
| 53 | 53 | $this->configuration = $configuration; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | $this->assertAcceptableConfiguration(); |
| 69 | 69 | |
| 70 | 70 | $this->registerResourceLoaderModules( |
| 71 | - $this->isReadablePath( $this->configuration['localBasePath'] ), |
|
| 72 | - $this->configuration[ 'remoteBasePath' ] |
|
| 71 | + $this->isReadablePath($this->configuration['localBasePath']), |
|
| 72 | + $this->configuration['remoteBasePath'] |
|
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | $this->registerCacheTriggers(); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * @param string $localBasePath |
| 84 | 84 | * @param string $remoteBasePath |
| 85 | 85 | */ |
| 86 | - protected function registerResourceLoaderModules( $localBasePath, $remoteBasePath ) { |
|
| 87 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array_replace_recursive( |
|
| 86 | + protected function registerResourceLoaderModules($localBasePath, $remoteBasePath) { |
|
| 87 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles'] = array_replace_recursive( |
|
| 88 | 88 | [ |
| 89 | 89 | 'localBasePath' => $localBasePath . '/scss', |
| 90 | 90 | 'remoteBasePath' => $remoteBasePath . '/scss', |
@@ -98,22 +98,22 @@ discard block |
||
| 98 | 98 | 'composer.lock' => null, |
| 99 | 99 | ], |
| 100 | 100 | ], |
| 101 | - array_key_exists( 'ext.bootstrap.styles', $GLOBALS[ 'wgResourceModules' ] ) ? |
|
| 102 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] : [] |
|
| 101 | + array_key_exists('ext.bootstrap.styles', $GLOBALS['wgResourceModules']) ? |
|
| 102 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles'] : [] |
|
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] = array_replace_recursive( |
|
| 105 | + $GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] = array_replace_recursive( |
|
| 106 | 106 | [ |
| 107 | 107 | 'localBasePath' => $localBasePath . '/js', |
| 108 | 108 | 'remoteBasePath' => $remoteBasePath . '/js', |
| 109 | 109 | 'scripts' => [], |
| 110 | 110 | ], |
| 111 | - array_key_exists( 'ext.bootstrap.scripts', $GLOBALS[ 'wgResourceModules' ] ) ? |
|
| 112 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] : [] |
|
| 111 | + array_key_exists('ext.bootstrap.scripts', $GLOBALS['wgResourceModules']) ? |
|
| 112 | + $GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] : [] |
|
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap' ] = [ |
|
| 116 | - 'dependencies' => [ 'ext.bootstrap.styles', 'ext.bootstrap.scripts' ], |
|
| 115 | + $GLOBALS['wgResourceModules']['ext.bootstrap'] = [ |
|
| 116 | + 'dependencies' => ['ext.bootstrap.styles', 'ext.bootstrap.scripts'], |
|
| 117 | 117 | ]; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @param string $id |
| 122 | 122 | * @return bool |
| 123 | 123 | */ |
| 124 | - protected function hasConfiguration( $id ) { |
|
| 125 | - return isset( $this->configuration[ $id ] ); |
|
| 124 | + protected function hasConfiguration($id) { |
|
| 125 | + return isset($this->configuration[$id]); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,28 +130,28 @@ discard block |
||
| 130 | 130 | * @return string |
| 131 | 131 | * @throws RuntimeException |
| 132 | 132 | */ |
| 133 | - protected function isReadablePath( $localBasePath ) { |
|
| 134 | - $localBasePath = str_replace( [ '\\', '/' ], DIRECTORY_SEPARATOR, $localBasePath ); |
|
| 133 | + protected function isReadablePath($localBasePath) { |
|
| 134 | + $localBasePath = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $localBasePath); |
|
| 135 | 135 | |
| 136 | - if ( is_readable( $localBasePath ) ) { |
|
| 136 | + if (is_readable($localBasePath)) { |
|
| 137 | 137 | return $localBasePath; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - throw new RuntimeException( "Expected an accessible {$localBasePath} path" ); |
|
| 140 | + throw new RuntimeException("Expected an accessible {$localBasePath} path"); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | protected function registerCacheTriggers() { |
| 144 | 144 | $defaultRecacheTriggers = [ |
| 145 | - 'LocalSettings.php' => $this->configuration[ 'IP' ] . '/LocalSettings.php', |
|
| 146 | - 'composer.lock' => $this->configuration[ 'IP' ] . '/composer.lock', |
|
| 145 | + 'LocalSettings.php' => $this->configuration['IP'] . '/LocalSettings.php', |
|
| 146 | + 'composer.lock' => $this->configuration['IP'] . '/composer.lock', |
|
| 147 | 147 | ]; |
| 148 | 148 | |
| 149 | - foreach ( $defaultRecacheTriggers as $key => $filename ) { |
|
| 150 | - if ( array_key_exists( $key, |
|
| 151 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ] ) && |
|
| 152 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] |
|
| 153 | - === null ) { |
|
| 154 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] = |
|
| 149 | + foreach ($defaultRecacheTriggers as $key => $filename) { |
|
| 150 | + if (array_key_exists($key, |
|
| 151 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers']) && |
|
| 152 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] |
|
| 153 | + === null) { |
|
| 154 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] = |
|
| 155 | 155 | $filename; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | 'IP' => 'Full path to working directory ($IP) not found.', |
| 165 | 165 | ]; |
| 166 | 166 | |
| 167 | - foreach ( $configElements as $key => $errorMessage ) { |
|
| 168 | - if ( !$this->hasConfiguration( $key ) ) { |
|
| 169 | - throw new InvalidArgumentException( $errorMessage ); |
|
| 167 | + foreach ($configElements as $key => $errorMessage) { |
|
| 168 | + if (!$this->hasConfiguration($key)) { |
|
| 169 | + throw new InvalidArgumentException($errorMessage); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -50,15 +50,15 @@ |
||
| 50 | 50 | * @throws \Exception |
| 51 | 51 | */ |
| 52 | 52 | public static function init() { |
| 53 | - $GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][] = function () { |
|
| 53 | + $GLOBALS['wgHooks']['SetupAfterCache'][] = function() { |
|
| 54 | 54 | $configuration = []; |
| 55 | - $configuration[ 'IP' ] = $GLOBALS[ 'IP' ]; |
|
| 56 | - $configuration[ 'remoteBasePath' ] = |
|
| 57 | - $GLOBALS[ 'wgExtensionAssetsPath' ] . '/Bootstrap/resources/bootstrap'; |
|
| 58 | - $configuration[ 'localBasePath' ] = |
|
| 59 | - $GLOBALS[ 'wgExtensionDirectory' ] . '/Bootstrap/resources/bootstrap'; |
|
| 55 | + $configuration['IP'] = $GLOBALS['IP']; |
|
| 56 | + $configuration['remoteBasePath'] = |
|
| 57 | + $GLOBALS['wgExtensionAssetsPath'] . '/Bootstrap/resources/bootstrap'; |
|
| 58 | + $configuration['localBasePath'] = |
|
| 59 | + $GLOBALS['wgExtensionDirectory'] . '/Bootstrap/resources/bootstrap'; |
|
| 60 | 60 | |
| 61 | - $setupAfterCache = new SetupAfterCache( $configuration ); |
|
| 61 | + $setupAfterCache = new SetupAfterCache($configuration); |
|
| 62 | 62 | $setupAfterCache->process(); |
| 63 | 63 | }; |
| 64 | 64 | } |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param ModuleDefinition $moduleDefinition |
| 51 | 51 | */ |
| 52 | - public function __construct( ModuleDefinition $moduleDefinition ) { |
|
| 52 | + public function __construct(ModuleDefinition $moduleDefinition) { |
|
| 53 | 53 | $this->moduleDefinition = $moduleDefinition; |
| 54 | - $this->moduleDescriptions = $this->moduleDefinition->get( 'descriptions' ); |
|
| 54 | + $this->moduleDescriptions = $this->moduleDefinition->get('descriptions'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @return BootstrapManager |
| 63 | 63 | */ |
| 64 | 64 | public static function getInstance() { |
| 65 | - if ( self::$instance === null ) { |
|
| 66 | - self::$instance = new self( new V4ModuleDefinition ); |
|
| 65 | + if (self::$instance === null) { |
|
| 66 | + self::$instance = new self(new V4ModuleDefinition); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return self::$instance; |
@@ -83,28 +83,28 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @param string|string[] $modules |
| 85 | 85 | */ |
| 86 | - public function addBootstrapModule( $modules ) { |
|
| 87 | - $modules = (array)$modules; |
|
| 86 | + public function addBootstrapModule($modules) { |
|
| 87 | + $modules = (array) $modules; |
|
| 88 | 88 | |
| 89 | - foreach ( $modules as $module ) { |
|
| 89 | + foreach ($modules as $module) { |
|
| 90 | 90 | |
| 91 | 91 | // if the module is known |
| 92 | - if ( isset( $this->moduleDescriptions[ $module ] ) ) { |
|
| 92 | + if (isset($this->moduleDescriptions[$module])) { |
|
| 93 | 93 | |
| 94 | - $description = $this->moduleDescriptions[ $module ]; |
|
| 94 | + $description = $this->moduleDescriptions[$module]; |
|
| 95 | 95 | |
| 96 | 96 | // prevent adding this module again; this also prevents infinite recursion in case |
| 97 | 97 | // of dependency resolution |
| 98 | - unset( $this->moduleDescriptions[ $module ] ); |
|
| 98 | + unset($this->moduleDescriptions[$module]); |
|
| 99 | 99 | |
| 100 | 100 | // first add any dependencies recursively, so they are available when the styles and |
| 101 | 101 | // scripts of $module are loaded |
| 102 | - if ( isset( $description[ 'dependencies' ] ) ) { |
|
| 103 | - $this->addBootstrapModule( $description[ 'dependencies' ] ); |
|
| 102 | + if (isset($description['dependencies'])) { |
|
| 103 | + $this->addBootstrapModule($description['dependencies']); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $this->addFilesToGlobalResourceModules( 'styles', $description ); |
|
| 107 | - $this->addFilesToGlobalResourceModules( 'scripts', $description ); |
|
| 106 | + $this->addFilesToGlobalResourceModules('styles', $description); |
|
| 107 | + $this->addFilesToGlobalResourceModules('scripts', $description); |
|
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * @param string $filetype 'styles'|'scripts' |
| 115 | 115 | * @param mixed[] $description |
| 116 | 116 | */ |
| 117 | - protected function addFilesToGlobalResourceModules( $filetype, $description ) { |
|
| 118 | - if ( isset( $description[ $filetype ] ) ) { |
|
| 117 | + protected function addFilesToGlobalResourceModules($filetype, $description) { |
|
| 118 | + if (isset($description[$filetype])) { |
|
| 119 | 119 | |
| 120 | - $this->adjustArrayElementOfResourceModuleDescription( $filetype, |
|
| 121 | - $description[ $filetype ], $filetype ); |
|
| 120 | + $this->adjustArrayElementOfResourceModuleDescription($filetype, |
|
| 121 | + $description[$filetype], $filetype); |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @since 4.0 |
| 130 | 130 | */ |
| 131 | 131 | public function addCoreBootstrapModules() { |
| 132 | - $this->addBootstrapModule( $this->moduleDefinition->get( 'core' ) ); |
|
| 132 | + $this->addBootstrapModule($this->moduleDefinition->get('core')); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @since 1.0 |
| 139 | 139 | */ |
| 140 | 140 | public function addAllBootstrapModules() { |
| 141 | - $this->addBootstrapModule( $this->moduleDefinition->get( 'optional' ) ); |
|
| 141 | + $this->addBootstrapModule($this->moduleDefinition->get('optional')); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @internal param string $path |
| 151 | 151 | */ |
| 152 | - public function addStyleFile( $path, $position = 'main' ) { |
|
| 153 | - $this->adjustArrayElementOfResourceModuleDescription( 'styles', |
|
| 154 | - [ $path => [ 'position' => $position ] ] ); |
|
| 152 | + public function addStyleFile($path, $position = 'main') { |
|
| 153 | + $this->adjustArrayElementOfResourceModuleDescription('styles', |
|
| 154 | + [$path => ['position' => $position]]); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * @param string $key the SCSS variable name |
| 161 | 161 | * @param string $value the value to assign to the variable |
| 162 | 162 | */ |
| 163 | - public function setScssVariable( $key, $value ) { |
|
| 164 | - $this->setScssVariables( [ $key => $value ] ); |
|
| 163 | + public function setScssVariable($key, $value) { |
|
| 164 | + $this->setScssVariables([$key => $value]); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -169,16 +169,16 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @param mixed[] $variables |
| 171 | 171 | */ |
| 172 | - public function setScssVariables( $variables ) { |
|
| 173 | - $this->adjustArrayElementOfResourceModuleDescription( 'variables', $variables ); |
|
| 172 | + public function setScssVariables($variables) { |
|
| 173 | + $this->adjustArrayElementOfResourceModuleDescription('variables', $variables); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | 177 | * @since 1.1 |
| 178 | 178 | * @param string|string[] $files |
| 179 | 179 | */ |
| 180 | - public function addCacheTriggerFile( $files ) { |
|
| 181 | - $this->adjustArrayElementOfResourceModuleDescription( 'cacheTriggers', $files ); |
|
| 180 | + public function addCacheTriggerFile($files) { |
|
| 181 | + $this->adjustArrayElementOfResourceModuleDescription('cacheTriggers', $files); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -186,16 +186,16 @@ discard block |
||
| 186 | 186 | * @param mixed $value |
| 187 | 187 | * @param string $filetype 'styles'|'scripts' |
| 188 | 188 | */ |
| 189 | - protected function adjustArrayElementOfResourceModuleDescription( $key, $value, |
|
| 190 | - $filetype = 'styles' ) { |
|
| 191 | - if ( !isset( $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] ) ) { |
|
| 192 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] = []; |
|
| 189 | + protected function adjustArrayElementOfResourceModuleDescription($key, $value, |
|
| 190 | + $filetype = 'styles') { |
|
| 191 | + if (!isset($GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key])) { |
|
| 192 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] = []; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] = |
|
| 195 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] = |
|
| 196 | 196 | array_merge( |
| 197 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ], |
|
| 198 | - (array)$value |
|
| 197 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key], |
|
| 198 | + (array) $value |
|
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | throw new \Exception('scssphp requires PHP 5.6 or above'); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if (! class_exists('ScssPhp\ScssPhp\Version', false)) { |
|
| 7 | +if (!class_exists('ScssPhp\ScssPhp\Version', false)) { |
|
| 8 | 8 | include_once __DIR__ . '/src/Base/Range.php'; |
| 9 | 9 | include_once __DIR__ . '/src/Block.php'; |
| 10 | 10 | include_once __DIR__ . '/src/Cache.php'; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->sourceName = $sourceName ?: '(stdin)'; |
| 91 | 91 | $this->sourceIndex = $sourceIndex; |
| 92 | 92 | $this->charset = null; |
| 93 | - $this->utf8 = ! $encoding || strtolower($encoding) === 'utf-8'; |
|
| 93 | + $this->utf8 = !$encoding || strtolower($encoding) === 'utf-8'; |
|
| 94 | 94 | $this->patternModifiers = $this->utf8 ? 'Aisu' : 'Ais'; |
| 95 | 95 | $this->commentsSeen = []; |
| 96 | 96 | $this->commentsSeen = []; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | ]; |
| 181 | 181 | $v = $this->cache->getCache('parse', $cacheKey, $parseOptions); |
| 182 | 182 | |
| 183 | - if (! \is_null($v)) { |
|
| 183 | + if (!\is_null($v)) { |
|
| 184 | 184 | return $v; |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $this->throwParseError(); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if (! empty($this->env->parent)) { |
|
| 215 | + if (!empty($this->env->parent)) { |
|
| 216 | 216 | $this->throwParseError('unclosed block'); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | isset($argUsing) ? $argUsing : null |
| 434 | 434 | ]; |
| 435 | 435 | |
| 436 | - if (! empty($hasBlock)) { |
|
| 436 | + if (!empty($hasBlock)) { |
|
| 437 | 437 | $include = $this->pushSpecialBlock(Type::T_INCLUDE, $s); |
| 438 | 438 | $include->child = $child; |
| 439 | 439 | } else { |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | while ( |
| 610 | 610 | $cond[0] === Type::T_LIST && |
| 611 | - ! empty($cond['enclosing']) && |
|
| 611 | + !empty($cond['enclosing']) && |
|
| 612 | 612 | $cond['enclosing'] === 'parent' && |
| 613 | 613 | \count($cond[2]) == 1 |
| 614 | 614 | ) { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | while ( |
| 663 | 663 | $cond[0] === Type::T_LIST && |
| 664 | - ! empty($cond['enclosing']) && |
|
| 664 | + !empty($cond['enclosing']) && |
|
| 665 | 665 | $cond['enclosing'] === 'parent' && |
| 666 | 666 | \count($cond[2]) == 1 |
| 667 | 667 | ) { |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $this->valueList($charset) && |
| 778 | 778 | $this->end() |
| 779 | 779 | ) { |
| 780 | - if (! isset($this->charset)) { |
|
| 780 | + if (!isset($this->charset)) { |
|
| 781 | 781 | $statement = [Type::T_CHARSET, $charset]; |
| 782 | 782 | |
| 783 | 783 | list($line, $column) = $this->getSourcePosition($s); |
@@ -849,8 +849,8 @@ discard block |
||
| 849 | 849 | |
| 850 | 850 | $inCssSelector = null; |
| 851 | 851 | if ($this->cssOnly) { |
| 852 | - $inCssSelector = (! empty($this->env->parent) && |
|
| 853 | - ! in_array($this->env->type, [Type::T_DIRECTIVE, Type::T_MEDIA])); |
|
| 852 | + $inCssSelector = (!empty($this->env->parent) && |
|
| 853 | + !in_array($this->env->type, [Type::T_DIRECTIVE, Type::T_MEDIA])); |
|
| 854 | 854 | } |
| 855 | 855 | // custom properties : right part is static |
| 856 | 856 | if ( |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | $start = $this->count; |
| 862 | 862 | |
| 863 | 863 | // but can be complex and finish with ; or } |
| 864 | - foreach ([';','}'] as $ending) { |
|
| 864 | + foreach ([';', '}'] as $ending) { |
|
| 865 | 865 | if ( |
| 866 | 866 | $this->openString($ending, $stringValue, '(', ')', false) && |
| 867 | 867 | $this->end() |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | if ($this->matchChar('}', false)) { |
| 1007 | 1007 | $block = $this->popBlock(); |
| 1008 | 1008 | |
| 1009 | - if (! isset($block->type) || $block->type !== Type::T_IF) { |
|
| 1009 | + if (!isset($block->type) || $block->type !== Type::T_IF) { |
|
| 1010 | 1010 | if ($this->env->parent) { |
| 1011 | 1011 | $this->append(null); // collect comments before next statement if needed |
| 1012 | 1012 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | $b->comments = []; |
| 1067 | 1067 | $b->parent = $this->env; |
| 1068 | 1068 | |
| 1069 | - if (! $this->env) { |
|
| 1069 | + if (!$this->env) { |
|
| 1070 | 1070 | $b->children = []; |
| 1071 | 1071 | } elseif (empty($this->env->children)) { |
| 1072 | 1072 | $this->env->children = $this->env->comments; |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | */ |
| 1153 | 1153 | protected function peek($regex, &$out, $from = null) |
| 1154 | 1154 | { |
| 1155 | - if (! isset($from)) { |
|
| 1155 | + if (!isset($from)) { |
|
| 1156 | 1156 | $from = $this->count; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | } |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | - if (! isset($token)) { |
|
| 1201 | + if (!isset($token)) { |
|
| 1202 | 1202 | return false; |
| 1203 | 1203 | } |
| 1204 | 1204 | |
@@ -1226,13 +1226,13 @@ discard block |
||
| 1226 | 1226 | { |
| 1227 | 1227 | $r = '/' . $regex . '/' . $this->patternModifiers; |
| 1228 | 1228 | |
| 1229 | - if (! preg_match($r, $this->buffer, $out, null, $this->count)) { |
|
| 1229 | + if (!preg_match($r, $this->buffer, $out, null, $this->count)) { |
|
| 1230 | 1230 | return false; |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | $this->count += \strlen($out[0]); |
| 1234 | 1234 | |
| 1235 | - if (! isset($eatWhitespace)) { |
|
| 1235 | + if (!isset($eatWhitespace)) { |
|
| 1236 | 1236 | $eatWhitespace = $this->eatWhiteDefault; |
| 1237 | 1237 | } |
| 1238 | 1238 | |
@@ -1253,13 +1253,13 @@ discard block |
||
| 1253 | 1253 | */ |
| 1254 | 1254 | protected function matchChar($char, $eatWhitespace = null) |
| 1255 | 1255 | { |
| 1256 | - if (! isset($this->buffer[$this->count]) || $this->buffer[$this->count] !== $char) { |
|
| 1256 | + if (!isset($this->buffer[$this->count]) || $this->buffer[$this->count] !== $char) { |
|
| 1257 | 1257 | return false; |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | 1260 | $this->count++; |
| 1261 | 1261 | |
| 1262 | - if (! isset($eatWhitespace)) { |
|
| 1262 | + if (!isset($eatWhitespace)) { |
|
| 1263 | 1263 | $eatWhitespace = $this->eatWhiteDefault; |
| 1264 | 1264 | } |
| 1265 | 1265 | |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | |
| 1288 | 1288 | $this->count += $len; |
| 1289 | 1289 | |
| 1290 | - if (! isset($eatWhitespace)) { |
|
| 1290 | + if (!isset($eatWhitespace)) { |
|
| 1291 | 1291 | $eatWhitespace = $this->eatWhiteDefault; |
| 1292 | 1292 | } |
| 1293 | 1293 | |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | // remaining part |
| 1347 | 1347 | $c = substr($this->buffer, $this->count, $endCommentCount - $this->count); |
| 1348 | 1348 | |
| 1349 | - if (! $comment) { |
|
| 1349 | + if (!$comment) { |
|
| 1350 | 1350 | // single part static comment |
| 1351 | 1351 | $this->appendComment([Type::T_COMMENT, $c]); |
| 1352 | 1352 | } else { |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | */ |
| 1376 | 1376 | protected function appendComment($comment) |
| 1377 | 1377 | { |
| 1378 | - if (! $this->discardComments) { |
|
| 1378 | + if (!$this->discardComments) { |
|
| 1379 | 1379 | $this->env->comments[] = $comment; |
| 1380 | 1380 | } |
| 1381 | 1381 | } |
@@ -1388,8 +1388,8 @@ discard block |
||
| 1388 | 1388 | */ |
| 1389 | 1389 | protected function append($statement, $pos = null) |
| 1390 | 1390 | { |
| 1391 | - if (! \is_null($statement)) { |
|
| 1392 | - if (! \is_null($pos)) { |
|
| 1391 | + if (!\is_null($statement)) { |
|
| 1392 | + if (!\is_null($pos)) { |
|
| 1393 | 1393 | list($line, $column) = $this->getSourcePosition($pos); |
| 1394 | 1394 | |
| 1395 | 1395 | $statement[static::SOURCE_LINE] = $line; |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | |
| 1693 | 1693 | $keyword = null; |
| 1694 | 1694 | |
| 1695 | - if (! $this->variable($keyword) || ! $this->matchChar(':')) { |
|
| 1695 | + if (!$this->variable($keyword) || !$this->matchChar(':')) { |
|
| 1696 | 1696 | $this->seek($s); |
| 1697 | 1697 | |
| 1698 | 1698 | $keyword = null; |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | return true; |
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | - if (! $endChar && $this->end()) { |
|
| 1734 | + if (!$endChar && $this->end()) { |
|
| 1735 | 1735 | return true; |
| 1736 | 1736 | } |
| 1737 | 1737 | } |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | return true; |
| 1758 | 1758 | } |
| 1759 | 1759 | |
| 1760 | - if (! $endChar && $this->end()) { |
|
| 1760 | + if (!$endChar && $this->end()) { |
|
| 1761 | 1761 | return true; |
| 1762 | 1762 | } |
| 1763 | 1763 | } |
@@ -1808,7 +1808,7 @@ discard block |
||
| 1808 | 1808 | return true; |
| 1809 | 1809 | } |
| 1810 | 1810 | |
| 1811 | - if (! $mandatoryParenthesis) { |
|
| 1811 | + if (!$mandatoryParenthesis) { |
|
| 1812 | 1812 | $this->seek($s); |
| 1813 | 1813 | |
| 1814 | 1814 | if ($this->valueList($out)) { |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | $items[] = $value; |
| 1855 | 1855 | |
| 1856 | 1856 | if ($delim) { |
| 1857 | - if (! $this->literal($delim, \strlen($delim))) { |
|
| 1857 | + if (!$this->literal($delim, \strlen($delim))) { |
|
| 1858 | 1858 | break; |
| 1859 | 1859 | } |
| 1860 | 1860 | |
@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | |
| 1870 | 1870 | if ( |
| 1871 | 1871 | strlen($word) > 1 && |
| 1872 | - in_array($last_char, [ "'", '"']) && |
|
| 1872 | + in_array($last_char, ["'", '"']) && |
|
| 1873 | 1873 | substr($word, -2, 1) !== '\\' |
| 1874 | 1874 | ) { |
| 1875 | 1875 | // if there is a non escaped opening quote in the keyword, this seems unlikely a mistake |
@@ -1915,7 +1915,7 @@ discard block |
||
| 1915 | 1915 | } |
| 1916 | 1916 | } |
| 1917 | 1917 | |
| 1918 | - if (! $items) { |
|
| 1918 | + if (!$items) { |
|
| 1919 | 1919 | $this->seek($s); |
| 1920 | 1920 | |
| 1921 | 1921 | return false; |
@@ -1982,7 +1982,7 @@ discard block |
||
| 1982 | 1982 | $this->seek($s); |
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | - if (! $listOnly && $this->value($lhs)) { |
|
| 1985 | + if (!$listOnly && $this->value($lhs)) { |
|
| 1986 | 1986 | if ($lookForExp) { |
| 1987 | 1987 | $out = $this->expHelper($lhs, 0); |
| 1988 | 1988 | } else { |
@@ -2029,11 +2029,11 @@ discard block |
||
| 2029 | 2029 | |
| 2030 | 2030 | if ( |
| 2031 | 2031 | $this->valueList($out) && |
| 2032 | - $this->matchChar($closingParen) && ! ($closingParen === ')' && |
|
| 2032 | + $this->matchChar($closingParen) && !($closingParen === ')' && |
|
| 2033 | 2033 | \in_array($out[0], [Type::T_EXPRESSION, Type::T_UNARY])) && |
| 2034 | 2034 | \in_array(Type::T_LIST, $allowedTypes) |
| 2035 | 2035 | ) { |
| 2036 | - if ($out[0] !== Type::T_LIST || ! empty($out['enclosing'])) { |
|
| 2036 | + if ($out[0] !== Type::T_LIST || !empty($out['enclosing'])) { |
|
| 2037 | 2037 | $out = [Type::T_LIST, '', [$out]]; |
| 2038 | 2038 | } |
| 2039 | 2039 | |
@@ -2086,11 +2086,11 @@ discard block |
||
| 2086 | 2086 | $op = $m[1]; |
| 2087 | 2087 | |
| 2088 | 2088 | // don't turn negative numbers into expressions |
| 2089 | - if ($op === '-' && $whiteBefore && ! $whiteAfter && ! $varAfter) { |
|
| 2089 | + if ($op === '-' && $whiteBefore && !$whiteAfter && !$varAfter) { |
|
| 2090 | 2090 | break; |
| 2091 | 2091 | } |
| 2092 | 2092 | |
| 2093 | - if (! $this->value($rhs) && ! $this->expression($rhs, true, false)) { |
|
| 2093 | + if (!$this->value($rhs) && !$this->expression($rhs, true, false)) { |
|
| 2094 | 2094 | break; |
| 2095 | 2095 | } |
| 2096 | 2096 | |
@@ -2119,7 +2119,7 @@ discard block |
||
| 2119 | 2119 | */ |
| 2120 | 2120 | protected function value(&$out) |
| 2121 | 2121 | { |
| 2122 | - if (! isset($this->buffer[$this->count])) { |
|
| 2122 | + if (!isset($this->buffer[$this->count])) { |
|
| 2123 | 2123 | return false; |
| 2124 | 2124 | } |
| 2125 | 2125 | |
@@ -2226,7 +2226,7 @@ discard block |
||
| 2226 | 2226 | |
| 2227 | 2227 | if ( |
| 2228 | 2228 | $this->keyword($inner) && |
| 2229 | - ! $this->func($inner, $out) |
|
| 2229 | + !$this->func($inner, $out) |
|
| 2230 | 2230 | ) { |
| 2231 | 2231 | $out = [Type::T_UNARY, '-', $inner, $this->inParens]; |
| 2232 | 2232 | |
@@ -2404,7 +2404,7 @@ discard block |
||
| 2404 | 2404 | return true; |
| 2405 | 2405 | } |
| 2406 | 2406 | |
| 2407 | - if ($name !== 'expression' && ! preg_match('/^(-[a-z]+-)?calc$/', $name)) { |
|
| 2407 | + if ($name !== 'expression' && !preg_match('/^(-[a-z]+-)?calc$/', $name)) { |
|
| 2408 | 2408 | $ss = $this->count; |
| 2409 | 2409 | |
| 2410 | 2410 | if ( |
@@ -2425,7 +2425,7 @@ discard block |
||
| 2425 | 2425 | ) { |
| 2426 | 2426 | $args = []; |
| 2427 | 2427 | |
| 2428 | - if (! empty($str)) { |
|
| 2428 | + if (!empty($str)) { |
|
| 2429 | 2429 | $args[] = [null, [Type::T_STRING, '', [$str]]]; |
| 2430 | 2430 | } |
| 2431 | 2431 | |
@@ -2467,14 +2467,14 @@ discard block |
||
| 2467 | 2467 | |
| 2468 | 2468 | $args[] = $arg; |
| 2469 | 2469 | |
| 2470 | - if (! $this->matchChar(',')) { |
|
| 2470 | + if (!$this->matchChar(',')) { |
|
| 2471 | 2471 | break; |
| 2472 | 2472 | } |
| 2473 | 2473 | |
| 2474 | 2474 | $args[] = [Type::T_STRING, '', [', ']]; |
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | - if (! $this->matchChar(')') || ! $args) { |
|
| 2477 | + if (!$this->matchChar(')') || !$args) { |
|
| 2478 | 2478 | $this->seek($s); |
| 2479 | 2479 | |
| 2480 | 2480 | return false; |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | if ($this->literal('...', 3)) { |
| 2519 | 2519 | $sss = $this->count; |
| 2520 | 2520 | |
| 2521 | - if (! $this->matchChar(')')) { |
|
| 2521 | + if (!$this->matchChar(')')) { |
|
| 2522 | 2522 | $this->throwParseError('... has to be after the final argument'); |
| 2523 | 2523 | } |
| 2524 | 2524 | |
@@ -2531,12 +2531,12 @@ discard block |
||
| 2531 | 2531 | |
| 2532 | 2532 | $args[] = $arg; |
| 2533 | 2533 | |
| 2534 | - if (! $this->matchChar(',')) { |
|
| 2534 | + if (!$this->matchChar(',')) { |
|
| 2535 | 2535 | break; |
| 2536 | 2536 | } |
| 2537 | 2537 | } |
| 2538 | 2538 | |
| 2539 | - if (! $this->matchChar(')')) { |
|
| 2539 | + if (!$this->matchChar(')')) { |
|
| 2540 | 2540 | $this->seek($s); |
| 2541 | 2541 | |
| 2542 | 2542 | return false; |
@@ -2558,7 +2558,7 @@ discard block |
||
| 2558 | 2558 | { |
| 2559 | 2559 | $s = $this->count; |
| 2560 | 2560 | |
| 2561 | - if (! $this->matchChar('(')) { |
|
| 2561 | + if (!$this->matchChar('(')) { |
|
| 2562 | 2562 | return false; |
| 2563 | 2563 | } |
| 2564 | 2564 | |
@@ -2573,12 +2573,12 @@ discard block |
||
| 2573 | 2573 | $keys[] = $key; |
| 2574 | 2574 | $values[] = $value; |
| 2575 | 2575 | |
| 2576 | - if (! $this->matchChar(',')) { |
|
| 2576 | + if (!$this->matchChar(',')) { |
|
| 2577 | 2577 | break; |
| 2578 | 2578 | } |
| 2579 | 2579 | } |
| 2580 | 2580 | |
| 2581 | - if (! $keys || ! $this->matchChar(')')) { |
|
| 2581 | + if (!$keys || !$this->matchChar(')')) { |
|
| 2582 | 2582 | $this->seek($s); |
| 2583 | 2583 | |
| 2584 | 2584 | return false; |
@@ -2601,7 +2601,7 @@ discard block |
||
| 2601 | 2601 | $s = $this->count; |
| 2602 | 2602 | |
| 2603 | 2603 | if ($this->match('(#([0-9a-f]+)\b)', $m)) { |
| 2604 | - if (\in_array(\strlen($m[2]), [3,4,6,8])) { |
|
| 2604 | + if (\in_array(\strlen($m[2]), [3, 4, 6, 8])) { |
|
| 2605 | 2605 | $out = [Type::T_KEYWORD, $m[0]]; |
| 2606 | 2606 | |
| 2607 | 2607 | return true; |
@@ -2627,7 +2627,7 @@ discard block |
||
| 2627 | 2627 | $s = $this->count; |
| 2628 | 2628 | |
| 2629 | 2629 | if ($this->match('([0-9]*(\.)?[0-9]+)([%a-zA-Z]+)?', $m, false)) { |
| 2630 | - if (\strlen($this->buffer) === $this->count || ! ctype_digit($this->buffer[$this->count])) { |
|
| 2630 | + if (\strlen($this->buffer) === $this->count || !ctype_digit($this->buffer[$this->count])) { |
|
| 2631 | 2631 | $this->whitespace(); |
| 2632 | 2632 | |
| 2633 | 2633 | $unit = new Node\Number($m[1], empty($m[3]) ? '' : $m[3]); |
@@ -2789,7 +2789,7 @@ discard block |
||
| 2789 | 2789 | |
| 2790 | 2790 | $this->eatWhiteDefault = $oldWhite; |
| 2791 | 2791 | |
| 2792 | - if (! $parts) { |
|
| 2792 | + if (!$parts) { |
|
| 2793 | 2793 | return false; |
| 2794 | 2794 | } |
| 2795 | 2795 | |
@@ -2818,7 +2818,7 @@ discard block |
||
| 2818 | 2818 | $oldWhite = $this->eatWhiteDefault; |
| 2819 | 2819 | $this->eatWhiteDefault = false; |
| 2820 | 2820 | |
| 2821 | - if ($nestingOpen && ! $nestingClose) { |
|
| 2821 | + if ($nestingOpen && !$nestingClose) { |
|
| 2822 | 2822 | $nestingClose = $end; |
| 2823 | 2823 | } |
| 2824 | 2824 | |
@@ -2844,7 +2844,7 @@ discard block |
||
| 2844 | 2844 | |
| 2845 | 2845 | $this->count -= \strlen($tok); |
| 2846 | 2846 | |
| 2847 | - if ($tok === $end && ! $nestingLevel) { |
|
| 2847 | + if ($tok === $end && !$nestingLevel) { |
|
| 2848 | 2848 | break; |
| 2849 | 2849 | } |
| 2850 | 2850 | |
@@ -2868,7 +2868,7 @@ discard block |
||
| 2868 | 2868 | |
| 2869 | 2869 | $this->eatWhiteDefault = $oldWhite; |
| 2870 | 2870 | |
| 2871 | - if (! $content || $tok !== $end) { |
|
| 2871 | + if (!$content || $tok !== $end) { |
|
| 2872 | 2872 | return false; |
| 2873 | 2873 | } |
| 2874 | 2874 | |
@@ -2960,7 +2960,7 @@ discard block |
||
| 2960 | 2960 | continue; |
| 2961 | 2961 | } |
| 2962 | 2962 | |
| 2963 | - if (! $parts && $this->match('[:.#]', $m, false)) { |
|
| 2963 | + if (!$parts && $this->match('[:.#]', $m, false)) { |
|
| 2964 | 2964 | // css hacks |
| 2965 | 2965 | $parts[] = $m[0]; |
| 2966 | 2966 | continue; |
@@ -2971,13 +2971,13 @@ discard block |
||
| 2971 | 2971 | |
| 2972 | 2972 | $this->eatWhiteDefault = $oldWhite; |
| 2973 | 2973 | |
| 2974 | - if (! $parts) { |
|
| 2974 | + if (!$parts) { |
|
| 2975 | 2975 | return false; |
| 2976 | 2976 | } |
| 2977 | 2977 | |
| 2978 | 2978 | // match comment hack |
| 2979 | 2979 | if (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) { |
| 2980 | - if (! empty($m[0])) { |
|
| 2980 | + if (!empty($m[0])) { |
|
| 2981 | 2981 | $parts[] = $m[0]; |
| 2982 | 2982 | $this->count += \strlen($m[0]); |
| 2983 | 2983 | } |
@@ -3001,7 +3001,7 @@ discard block |
||
| 3001 | 3001 | { |
| 3002 | 3002 | $s = $this->count; |
| 3003 | 3003 | |
| 3004 | - if (! $this->literal('--', 2, false)) { |
|
| 3004 | + if (!$this->literal('--', 2, false)) { |
|
| 3005 | 3005 | return false; |
| 3006 | 3006 | } |
| 3007 | 3007 | |
@@ -3065,7 +3065,7 @@ discard block |
||
| 3065 | 3065 | while ($this->selector($sel, $subSelector)) { |
| 3066 | 3066 | $selectors[] = $sel; |
| 3067 | 3067 | |
| 3068 | - if (! $this->matchChar(',', true)) { |
|
| 3068 | + if (!$this->matchChar(',', true)) { |
|
| 3069 | 3069 | break; |
| 3070 | 3070 | } |
| 3071 | 3071 | |
@@ -3074,7 +3074,7 @@ discard block |
||
| 3074 | 3074 | } |
| 3075 | 3075 | } |
| 3076 | 3076 | |
| 3077 | - if (! $selectors) { |
|
| 3077 | + if (!$selectors) { |
|
| 3078 | 3078 | $this->seek($s); |
| 3079 | 3079 | |
| 3080 | 3080 | return false; |
@@ -3126,7 +3126,7 @@ discard block |
||
| 3126 | 3126 | break; |
| 3127 | 3127 | } |
| 3128 | 3128 | |
| 3129 | - if (! $selector) { |
|
| 3129 | + if (!$selector) { |
|
| 3130 | 3130 | return false; |
| 3131 | 3131 | } |
| 3132 | 3132 | |
@@ -3159,7 +3159,7 @@ discard block |
||
| 3159 | 3159 | } |
| 3160 | 3160 | |
| 3161 | 3161 | for (;;) { |
| 3162 | - if (! isset($this->buffer[$this->count])) { |
|
| 3162 | + if (!isset($this->buffer[$this->count])) { |
|
| 3163 | 3163 | break; |
| 3164 | 3164 | } |
| 3165 | 3165 | |
@@ -3286,7 +3286,7 @@ discard block |
||
| 3286 | 3286 | ) { |
| 3287 | 3287 | $parts[] = '('; |
| 3288 | 3288 | |
| 3289 | - if (! empty($str)) { |
|
| 3289 | + if (!empty($str)) { |
|
| 3290 | 3290 | $parts[] = $str; |
| 3291 | 3291 | } |
| 3292 | 3292 | |
@@ -3321,7 +3321,7 @@ discard block |
||
| 3321 | 3321 | ) { |
| 3322 | 3322 | $parts[] = '['; |
| 3323 | 3323 | |
| 3324 | - if (! empty($str)) { |
|
| 3324 | + if (!empty($str)) { |
|
| 3325 | 3325 | $parts[] = $str; |
| 3326 | 3326 | } |
| 3327 | 3327 | |
@@ -3347,7 +3347,7 @@ discard block |
||
| 3347 | 3347 | |
| 3348 | 3348 | $this->eatWhiteDefault = $oldWhite; |
| 3349 | 3349 | |
| 3350 | - if (! $parts) { |
|
| 3350 | + if (!$parts) { |
|
| 3351 | 3351 | return false; |
| 3352 | 3352 | } |
| 3353 | 3353 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | $this->write($inner . implode($glue, $block->lines)); |
| 64 | 64 | |
| 65 | - if (empty($block->selectors) || ! empty($block->children)) { |
|
| 65 | + if (empty($block->selectors) || !empty($block->children)) { |
|
| 66 | 66 | $this->write($this->break); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | static $previousHasSelector; |
| 83 | 83 | |
| 84 | 84 | if ($block->type === 'root') { |
| 85 | - $depths = [ 0 ]; |
|
| 85 | + $depths = [0]; |
|
| 86 | 86 | $downLevel = ''; |
| 87 | 87 | $closeBlock = ''; |
| 88 | 88 | $this->depth = 0; |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | $this->depth--; |
| 100 | 100 | |
| 101 | 101 | if ( |
| 102 | - ! $this->depth && ($block->depth <= 1 || (! $this->indentLevel && $block->type === Type::T_COMMENT)) && |
|
| 103 | - (($block->selectors && ! $isMediaOrDirective) || $previousHasSelector) |
|
| 102 | + !$this->depth && ($block->depth <= 1 || (!$this->indentLevel && $block->type === Type::T_COMMENT)) && |
|
| 103 | + (($block->selectors && !$isMediaOrDirective) || $previousHasSelector) |
|
| 104 | 104 | ) { |
| 105 | 105 | $downLevel = $this->break; |
| 106 | 106 | } |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $this->currentBlock = $block; |
| 118 | 118 | |
| 119 | - if (! empty($block->lines) || (! empty($block->children) && ($this->depth < 1 || $isSupport))) { |
|
| 119 | + if (!empty($block->lines) || (!empty($block->children) && ($this->depth < 1 || $isSupport))) { |
|
| 120 | 120 | if ($block->depth > end($depths)) { |
| 121 | - if (! $previousEmpty || $this->depth < 1) { |
|
| 121 | + if (!$previousEmpty || $this->depth < 1) { |
|
| 122 | 122 | $this->depth++; |
| 123 | 123 | |
| 124 | 124 | $depths[] = $block->depth; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $previousEmpty = ($block->type === Type::T_COMMENT); |
| 135 | 135 | $previousHasSelector = false; |
| 136 | 136 | |
| 137 | - if (! empty($block->selectors)) { |
|
| 137 | + if (!empty($block->selectors)) { |
|
| 138 | 138 | if ($closeBlock) { |
| 139 | 139 | $this->write($closeBlock); |
| 140 | 140 | $closeBlock = ''; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $this->indentLevel++; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (! empty($block->lines)) { |
|
| 153 | + if (!empty($block->lines)) { |
|
| 154 | 154 | if ($closeBlock) { |
| 155 | 155 | $this->write($closeBlock); |
| 156 | 156 | $closeBlock = ''; |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | $closeBlock = $this->break; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if (! empty($block->children)) { |
|
| 170 | - if ($this->depth > 0 && ($isMediaOrDirective || ! $this->hasFlatChild($block))) { |
|
| 169 | + if (!empty($block->children)) { |
|
| 170 | + if ($this->depth > 0 && ($isMediaOrDirective || !$this->hasFlatChild($block))) { |
|
| 171 | 171 | array_pop($depths); |
| 172 | 172 | |
| 173 | 173 | $this->depth--; |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | $previousHasSelector = false; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if (! empty($block->selectors)) { |
|
| 188 | + if (!empty($block->selectors)) { |
|
| 189 | 189 | $this->indentLevel--; |
| 190 | 190 | |
| 191 | - if (! $this->keepSemicolons) { |
|
| 191 | + if (!$this->keepSemicolons) { |
|
| 192 | 192 | $this->strippedSemicolon = ''; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $closeBlock = $this->break; |
| 198 | 198 | |
| 199 | - if ($this->depth > 1 && ! empty($block->children)) { |
|
| 199 | + if ($this->depth > 1 && !empty($block->children)) { |
|
| 200 | 200 | array_pop($depths); |
| 201 | 201 | $this->depth--; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (! $isMediaOrDirective) { |
|
| 204 | + if (!$isMediaOrDirective) { |
|
| 205 | 205 | $previousHasSelector = true; |
| 206 | 206 | } |
| 207 | 207 | } |